SA0033 : Do not use the GROUP BY clause without an aggregate function | ![]() |
The topic describes the SA0033 analysis rule.
Do not use the GROUP BY clause without an aggregate function
Consider using DISTINCT option instead of using the GROUP BY clause without using aggregate function, because the DISTINCT option will be faster and will give the same end result. Do not use the GROUP BY clause without an aggregate function.
![]() |
---|
The rule is deprecated in the new SQL Server versions. The execution plan generated by using the GROUP BY is not different than the one of using DISTINCT. |
The rule has a Batch scope and is applied only on the SQL script.
Rule has no parameters.
The rule does not need Analysis Context or SQL Connection.
Performance Rules
There is no additional info for this rule.
1-- GROUP BY clause used without aggregate function in order to return distinct rows 2SELECT ColumnA , 3 ColumnB 4FROM T 5GROUP BY ColumnA , 6 ColumnB 7 8-- The statement returns equivalent results as the above 9SELECT DISTINCT 10 ColumnA , 11 ColumnB 12FROM T
Message | Line | Column | |
---|---|---|---|
1 | SA0033 : Do not use the GROUP BY clause without an aggregate function. | 5 | 0 |
© Ubitsoft Ltd. All Rights Reserved.