SQL中的GROUP BY

来源:百度知道 编辑:UC知道 时间:2024/04/28 12:34:34
请高手指点~
能不能把时间按每周分组~!
急~!
谢谢~!

select datepart(ww,YourDate)
from YourTable
group by datepart(ww,voucherdate)

我用mysql,WEEK()函数返回该时间在该年的周数
select count(*),WEEK(时间字段名) from 表名 group by WEEK(时间字段名)

别的数据库肯定也有返回周数的函数