Home Forums SQL Server 2008 T-SQL (SS2K8) use column in Group By, but Hide column from the results set RE: use column in Group By, but Hide column from the results set

  • siggemannen (9/20/2012)


    These kind of queries have real usage, for example if you want to preserve "duplicate rows" of Col1, Col2, which cannot be preserved if you only Group By Col1

    Grouping By something which is not in the select is fine, I'm sure there are plenty of uses for that.

    But the original requirement - to include a column in select and in group by but then not to display it - is not so fine. I cannot think of a single use for that, other than as an example for a 'how to write superfluous SQL' book.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.