how to dispaly subtotals

  • Jeff Moden (12/20/2015)


    As for not actually being a result set, I agree to disagree. There's nothing preventing all of the subsets from being a part of a larger set. Each set is individually selectable, could be selected as a Union even with disparate sets (not shown in the diagram), as are all of the sets as a whole.

    I suppose it's more of a difference in perspective than an actual disagreement... In one sense, I'll agree that, anything that's generated as the result of a query execution could be considered a "result set"... Then again, you could go in the opposite direction and use the strict definition of a "set" used in relational algebra... Which (among other requirements) states that all rows must have no particular order... In which case, any result generated by a query that has an ORDER BY clause would fail to meet the definition.

    That said, I do think (aka just my own opinion) that there is something to be said for the idea that the values that output under a specific column head should be representative of that column... So, if I'm outputting a column called "Products" every value that appears in that column should be a "Product". Allowing any other values, such a "Sales Person", "Order Date" or "Subtotal" into that column just compromises the validity of the data. (again just my 2 cents).

  • I absolutely agree with the technical idea of columns supporting only one type of data in order to actually be a "result set" even in reports. I've even written some reports that way. Sadly, the general public disagrees especially when it comes to reporting and especially on spreadsheets and things that look like spreadsheets. To wit, I consider the first result set to be more correct than any that follow and it's still incorrect because it mixes totals with raw data in the same column. I suppose this is why most folks do agree that reporting is usually best left to reporting applications. Perhaps I've fallen into the trap from the old screen-scraping days of calling a report a set in this case unless I'm forgiven by the alternate definition of "anything returned by a single query is called a result set".

    Heh... now, if you really want to have some fun, do the NULLs in the first result set indicate a known value or unknown condition? Just kidding... that's a discussion best left to people that make a living from such discussions. 😀

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    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.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • LOL... NULLs eh? Are you referring to "Missing & Applicable" or "Missing & Not applicable"? I think that's up there with religion & politics... 😛

  • Jason A. Long (12/20/2015)


    LOL... NULLs eh? Are you referring to "Missing & Applicable" or "Missing & Not applicable"? I think that's up there with religion & politics... 😛

    I was thinking of the "Unknown except for on Tuesdays when the Red Nulls are different than the Blue ones unless it's a month than has a leap microsecond in it". 😛

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    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.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Now I feel cheated... Mine only came with the yellow ones... :unsure:

Viewing 5 posts - 16 through 19 (of 19 total)

You must be logged in to reply to this topic. Login to reply