我正在尝试从一个数据库‘零售商’中提取,并按国家显示,美国是第一个。然后,按照状态的字母顺序排序,然后在每个状态中按名称排序。
它可能会像这样打印出来...
美国
Alabama
Acme Retail Store
Another Alphabetized Store
Florida
Computer Store
Wyoming
Computer Store Also阿尔及利亚
Algerian Retail Store英国
English Retail Store等等。等等。等等。
我已经正确地从数据库中提取了它,只是需要帮助对它进行排序。
有什么建议吗?
发布于 2011-04-17 00:40:12
order by
case when country = 'usa' then 0 else 1 end asc
, country asc
, state asc
, name asc应该做这件事。
https://stackoverflow.com/questions/5687962
复制相似问题