• Miles Neale (9/23/2008)


    Great Question. I got it right but for the wrong reason. After the explanation I see most people's point about the same not being the same.

    I always thought that 1 + 2 = 3, and that 2 + 1 = 3, so they are equivalent right? Does 1 + 2 = 2 + 1? Or are the so different as to make one wonder?

    Looked at as simple text, Query 1 (using GROUPING SETS) is not the same as Query 2 (using UNION ALL), in the same way that "1+2" is not the same as "2+1".

    However, most people would assume that the QoTD was asking more than a simple text comparison, i.e. is query 1 equivalent to query 2?

    The reference given says it is, since the queries given there are exactly as in the question! Hence the answer stated is wrong!

    Derek