Sql queries for updating a column divorce and dating again

by  |  22-Mar-2014 04:46

I don't have a key for the temporary table and am concerned that even if I did create a key, it doesn't get past the fact that I have to group by non-key columns and match up the aggregate data to the same group of non-key columns.

Also, the numbers of denormalized columns need to hold aggregate data won't be known until run-time, though there is a upper limit due to the CASE WHEN statement contained in UPDATE statement (no dynamic SQL here, thank you).

I am sure I'm missing something blindingly obvious but here it is: I'm trying to create a recordset in a denormalized fashion for reporting.

Part of the requirement is to update a temporary staging table with column containing aggregate results.

These guidelines are designed to be compatible with Joe Celko’s SQL Programming Style book to make adoption for teams who have already read that book easier.

This guide is a little more opinionated in some areas and in others a little more relaxed.

Spaces should be used to line up the code so that the root keywords all end on the same character boundary.

Community Discussion