标签:status 用法 状态 from -- logs stat cas else
--统计各种状态的总个数 SELECT sum(CASE WHEN [Status] =-1 THEN 1 ELSE 0 END ) AS Q1, sum(CASE WHEN [Status] =0 THEN 1 ELSE 0 END ) AS Q2, sum(CASE WHEN [Status] =1 THEN 1 ELSE 0 END ) AS Q3, sum(CASE WHEN [Status] =2 THEN 1 ELSE 0 END ) AS Q4, sum(CASE WHEN [Status] =3 THEN 1 ELSE 0 END ) AS Q5, sum(CASE WHEN [Status] =4 THEN 1 ELSE 0 END ) AS Q6, sum(CASE WHEN [Status] =5 THEN 1 ELSE 0 END ) AS Q7 FROM OrderInfo
标签:status 用法 状态 from -- logs stat cas else
原文地址:http://www.cnblogs.com/johnwood/p/6633814.html