一年分别按周分组
Group by week separately for year
我必须按周对 sql 查询进行分组。但记录包含多年的数据。我使用了查询 SELECT datepart(week, myDate) as week
。但在第 1 周下,它显示了每年的数据
如何将同一年的周重新分组
SELECT datepart(week, myDate) as week, datepart(year, myDate) as year, ... from table group by concat(year, '-', week);
我必须按周对 sql 查询进行分组。但记录包含多年的数据。我使用了查询 SELECT datepart(week, myDate) as week
。但在第 1 周下,它显示了每年的数据
如何将同一年的周重新分组
SELECT datepart(week, myDate) as week, datepart(year, myDate) as year, ... from table group by concat(year, '-', week);