嗨,我在 DB2 中有 SQL 语句,它正在工作。
select distinct 'IN' as STATUS,
(select count(*) from table.......)
from table
UNION ALL
select distinct 'OUT',
(select count(*) from table.......)
from table
UNION ALL
select distinct 'FINISHED',
(select count(*) from table.......)
from table
order by status
但是如果我将最后一行更改为
order by
case STATUS
when 'IN' then 1
when 'OUT' then 2
when 'FINISHED' then 3
end
我的查询不起作用。有人可以告诉我如何解决这个问题吗?谢谢