我正试图从数据库'零售商'中提取并按国家显示,而美国是第一位的。然后,按状态按字母顺序排序,然后按每个州内的名称排序。
它应该像这样打印......
美国
Alabama
Acme Retail Store
Another Alphabetized Store
Florida
Computer Store
Wyoming
Computer Store Also
阿尔及利亚
Algerian Retail Store
英国
English Retail Store
等等......等等......
我已经正确地从数据库中取出它,只需要帮助对它进行排序。
有什么建议吗?
答案 0 :(得分:2)
order by
case when country = 'usa' then 0 else 1 end asc
, country asc
, state asc
, name asc
应该这样做。