fetch records in specific order but keep some specific records in always top mysql
I have one DB table called table1
have some col开发者_运维技巧umns two of them are
purchased enum ('Y','N') default 'N';
created timestamp ;
I want to fetch records newest on top but the records with purchased 'Y'
will always be on very top and these records should also be sorted in newest to oldest.
How do I do query?
SELECT * FROM table1 ORDER BY purchased DESC, created DESC
精彩评论