I need to do GROUP BY after ORDER BY . I do not understand why MySQL does not support this. This is my code:
SELECT `pages`.`id`, `contents`.`id_language`, [...] [...] ORDER BY FIND_IN_SET(`languages`.`id`, '3') DESC [the GROUP BY]
The results will be something like this:
id | id_language | ... 1 3 1 1 2 3 2 5 2 1
I need to group by ID, I only need the first result, and I need to save it as. Because of this, I cannot use SUBQUERY.
The result should be:
id | id_language | ... 1 3 2 3
Note. Do not confuse id_language = 3 , because this is not a rule.
mysql sql-order-by group-by
David Rodrigues
source share