0

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?

good_evening
  • 21,085
  • 65
  • 193
  • 298

1 Answers1

5

Use the FIELD() construct available in MySQL:

SELECT       stuff
    FROM     table
    WHERE    condition
    ORDER BY FIELD(column13, 'val', 'aaa', 'ccc')
Mihai Stancu
  • 15,848
  • 2
  • 33
  • 51