select datename(weekday,CAST([CompletedTime] AS date)) WeekNum, CAST([CompletedTime] AS date) AS 'Date' , SUM(case when OrderStatus=2 and IsDeleted=0 then PlatformAmount else 0 end) as PlatformAmount, SUM(case when OrderStatus=2 and IsDeleted=0 then AgentAmount else 0 end) as AgentAmount, SUM(case when OrderStatus=2 and IsDeleted=0 then TenantAmount else 0 end) as TenantAmount from QYNET_Order where datediff(week,CompletedTime,getdate()-1)=0 group by CAST([CompletedTime] AS date) order by Date ———————————————— 版权声明:本文为CSDN博主「xiaobingge2018」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/xiaobingge2018/java/article/details/103830406
该博客仅做记录使用。侵删。