SQL:Mysql 按周分组聚合统计
2021-01-01 本文已影响0人
Ryan96
select pid,DATE_FORMAT(create_date,'%Y%u') weeks,sum(total) countTotal from table_name
where in_out=2
GROUP BY pid,weeks
order by weeks desc
select pid,DATE_FORMAT(create_date,'%Y%u') weeks,sum(total) countTotal from table_name
where in_out=2
GROUP BY pid,weeks
order by weeks desc