This is where a good analyst would ask for a more explicit meaning of what constitutes a "gift" or "present" and how they can be taken as some as being totally different from "items". I obviously took the likes of 5 golden rings to be a single gift because the problem had the following definition in it...
"The song presents A new gift during each of the verses."
That would relegate to a the simple problem of being a Triangular Join which, in this case, would be solved by SUM(N) because of the WHERE clause against the Tally-table-structure.
I agree that a Triangular Cube is the correct solution if you consider each item as a separate gift but that wasn't obvious in the question.
Anyway, MERRY CHRISTMAS everyone!
is pronounced "ree-bar
" and is a "Modenism
" for R
First step towards the paradigm shift of writing Set Based code:
________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
"Change is inevitable... change for the better is not".
"Dear Lord... I'm a DBA so please give me patience because, if you give me strength, I'm going to need bail money too!"
How to post code problems
How to Post Performance Problems
Create a Tally Function (fnTally)