假设我在表tbl中以非经典的方式(不是按顺序)拥有国家数据.现在我想以'United States','Canada' & 'India'升序显示国家/地区的首位和其他国家 /地区.
Country
India
China
Brazil
Azerbaijan
Bahamas
United State
Denmark
Canada
Run Code Online (Sandbox Code Playgroud)
现在我希望这些数据为:
Country
United State // US,Canada,India should be First 3.
Canada
India
Azerbaijan // After rest country comes in ascending Order.
Bahamas
Brazil
China
Denmark
Run Code Online (Sandbox Code Playgroud)
任何建议真的很感激.
SELECT Country FROM tbl
ORDER BY CASE
WHEN Country='United State' THEN 0
WHEN Country='Canada' THEN 1
WHEN Country='India' THEN 2
ELSE 3
END, Country;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
567 次 |
| 最近记录: |