sql server 中按照周進(jìn)行匯總
當(dāng)前位置:點(diǎn)晴教程→知識(shí)管理交流
→『 技術(shù)文檔交流 』
一種寫法:
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 編輯過 |
關(guān)鍵字查詢
相關(guān)文章
正在查詢... |