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')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.