Skip navigation links
Showing entries 1 to 2

Tags Filter: group by (reset)

Presentations
Add to Favourites +0 Vote Up -0Vote Down
How MySQL Handles ORDER BY, GROUP BY, and DISTINCT
Articles
Add to Favourites +2 Vote Up -0Vote Down
There is a popular myth about the SQL GROUP BY clause. The myth holds that 'standard SQL' requires columns referenced in the SELECT list of a query to also appear in the GROUP BY clause, unless these columns appear exclusively in an aggregated expression. MySQL is often accused of violating this standard. In this article I will attempt to debunk this myth, and to provide a more balanced view regarding MySQL's treatment of GROUP BY at the same time. To do that, I will first demonstrate that MySQL can be instructed to only accept GROUP BY clauses that include all non-aggregated expressions referred to in the SELECT list, thus making MySQL's behaviour conform more to that of other well-known rdbms-products. Second, I will show that it is very important to clearly define which version of the SQL-standard is being referred to. The two most recent versions use a rather sophisticated way of  []
Showing entries 1 to 2