sql

string strSQL = @"select count(1) as AllTotal,
isnull(sum(case when OrderStatus=0 and IsPay<>0 then 1 else 0 end) ,0) as NoSendedNum,
isnull(sum(case OrderStatus when 1 then 1 else 0 end),0) as SendedNum,
isnull(sum(case OrderStatus when 2 then 1 else 0 end),0) as finishedNum,
isnull(sum(case OrderStatus when 3 then 1 else 0 end),0) as CancelNum,
isnull(sum(case when IsPay=0 and OrderSource is not null then 1 else 0 end),0) as WaitPayNum
from TB_FreshExchangeInfo where 1=1 ";

原文地址:https://www.cnblogs.com/muxueyuan/p/7692473.html