我有一张表,其中包含所有国家名称以及金额字段的列表。我需要的是在上升的名字以显示与量,在顶部为了不等于0的国名,然后用电量的值显示该国0.1以非空值先显示结果然后用空值显示结果
Name Amount
Afghanistan 0
Argentina 0
China 0.1
Crotia 0
Hongkong 0.08
India 0.2
Singapore 0.007
Taiwan 0.22
所需的输出:
Name Amount
China 0.1
Hongkong 0.08
India 0.2
Singapore 0.007
Taiwan 0.22
Afghanistan 0
Argentina 0
Crotia 0
我已经尝试过,直到现在,但它不工作。
select * from countries where amount !=0 ORDER by name ASC
UNION ALL
SELECT * from countries where amount == 0 ORDER BY name ASC
向上投票。结果是正确的。 – Learning