开发者

MYSQL - sort a list, how to always have one result at the end?

I have a table with just as ID and a value. Let's say this list have 4 items, such as Apple,Banana, Zuchinni, and Other. I want to sort the list alphabetically, but always have 'Other' be the last option开发者_JAVA技巧. Is there a way to accomplish this using a query?


ORDER BY `column_name` = 'Other', `column_name`


Sort by IIF(item = 'Other', 1, 0) first, or whatever the mysql equivalent is, then your item column.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜