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

  • You get too complicated. This should work.

    This will also give incomplete information on how the groups are made.

    SELECT Col1, Count(*) AS Count_Rec

    FROM MyTable

    GROUP BY Col1, Col2

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2