Let’s have a look at difference between distinct and group by in SQL Server . Distinct is used to find unique/distinct records where as a group by is used to group a selected set of rows into summary rows by one or more columns or an expression. The functional difference is thus obvious.
The group by can also be used to find distinct values as shown in below query.
The two queries return same result. The group by gives the same result as of distinct when no aggregate function is present. The SQL Server query optimizer produces the same plan for both the queries as shown below.
Thus, to conclude there is a functional difference as mentioned above even if the group by produces same result as of distinct. Group By operator is meant for aggregating/grouping rows where as distinct is just used to get distinct values.