sql server 中按照周进行汇总
当前位置:点晴教程→知识管理交流
→『 技术文档交流 』
一种写法:
select sum(number) as 销售总额,DATEPART(week,sell_date),convert(varchar(10), dateadd(day,-1,DATEADD(wk,datediff(wk,0,rtrim(datepart(year, sell_date )))+datepart(wk,sell_date )-1,0)) , 20)
from sell_info where 1=1 and sell_date >= '2011-01-01' and sell_date <= '2011-03-01'
group by DATEPART(week,sell_date), convert(varchar(10), dateadd(day,-1,DATEADD(wk,datediff(wk,0,rtrim(datepart(year, sell_date )))+datepart(wk,sell_date )-1,0)) , 20) 其他写法: 该文章在 2023/3/7 23:36:47 编辑过 |
关键字查询
相关文章
正在查询... |