日期:2014-05-18 浏览次数:20689 次
select sum(case when OState=1 then 1 else 0 end) as '新订单' , sum(case when OState=2 then 1 else 0 end) as '确认订单' sum(case when OState=3 then 1 else 0 end) as '发货订单', sum(case when OState=4 then 1 else 0 end) as '成交订单' from Orders
------解决方案--------------------
select sum(case when OState=1 then 1 else 0 end)新订单 ,sum(case when OState=2 then 1 else 0 end)确认订单 , sum(case when OState=3 then 1 else 0 end)发货订单 , sum(case when OState=4 then 1 else 0 end)成交订单 from Orders
------解决方案--------------------
SELECT SUM(CASE WHEN OState = 1 THEN 1 ELSE 0 END) 新订单, SUM(CASE WHEN OState = 2 THEN 1 ELSE 0 END) 确认订单, SUM(CASE WHEN OState = 3 THEN 1 ELSE 0 END) 发货订单, SUM(CASE WHEN OState = 4 THEN 1 ELSE 0 END) 成交订单 FROM Orders