mysql:sql按照某个字段排序,并且另一个字段为NULL或者空字符串或固定字符串排后面

1.按照year从高到低排序,但是如果thumb为空,即使year很高也要排在有thumb的最低的year后面

1
select * from TABLE order by thumb is null,year desc;

2.按照year从高到低排序,但是如果thumb为空字符串,即使year很高也要排在有thumb的最低的year后面

1
select * from TABLE order by thumb ='',year desc;

1.按照year从高到低排序,但是如果thumb为固定字符串no picture,即使year很高也要排在有thumb的最低的year后面

1
select * from TABLE order by thumb = 'no picture',year desc;
-------------本文结束 感谢您的阅读-------------