How to order entries by one column (let's say named column13
). First should be entries where column13
is "val", then "aaa", then "ccc". I can't use GROUP BY column13 ASC
or similar. Is it possible to do it without writing 3 queries?
Use the FIELD()
construct available in MySQL:
SELECT stuff
FROM table
WHERE condition
ORDER BY FIELD(column13, 'val', 'aaa', 'ccc')