GROUP BY and DISTINCT can return the same results when looking for uniqueness in a resultset. Consider the Sales table below.
Store Product Date
A Monopoly 1/10/2010
B Connect 4 1/12/2010
A Monopoly 1/14/2010
A Battle Ship 1/16/2010
B Othelo 1/16/2010
If you wanted to know what games each store sold from 1/10/2010 through 1/16/2010 you could write either of the following queries:
So which one?? I hate to admit it but back when I first got into SQL performance tuning I was working in an Oracle 8i environment. If I remember correctly, GROUP BY performed better than DISTINCT for one reason or another. Well in the days of SQL Server 2005 and 2008, GROUP BY and DISTINCT perform equivalently. Therefore, my rule of thumb is to use DISTINCT when no aggregations on additional, non-unique columns are necessary. If you just want unique combinations of store and game use distinct. If you want to know how many of each game were sold by store then use GROUP BY.