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.
精彩评论