Categories: "Databases"

mySQL DISTINCT FUNCTION(...) bug

Looks like mySQL is not able to to perform the DISTINCT selection in cases like this:

SELECT DISTINCT YEAR(post_date), MONTH(post_date) 
  FROM whatever1 INNER JOIN whatever2 ON field1 = field2
 ORDER BY post_date

This can be worked around, but it seems ridiculous!...

SELECT DISTINCT YEAR(post_date), MONTH(post_date) 
  FROM whatever1 INNER JOIN whatever2 ON field1 = field2
 ORDER BY YEAR(post_date), MONTH(post_date)