如何在php/sql中显示当月的周报,并将其标记为“第一周、第二周等”。在第1周下是第1周的记录,依此类推...
这是我当前的代码,它只显示每周的记录总数。
select count(*) as totalWeeklycomplaints
from tblcomplain group by week(dateposted);

发布于 2018-04-07 21:35:20
如果需要该周,请将其作为一列包括在内:
select week(dateposted), count(*) as totalWeeklycomplaints
from tblcomplain
group by week(dateposted);因为周是以年为单位重复的,所以我建议您也包括年份:
select year(dateposted), week(dateposted), count(*) as totalWeeklycomplaints
from tblcomplain
group by year(dateposted), week(dateposted);除此之外,我不太清楚你想要什么。
https://stackoverflow.com/questions/49707902
复制相似问题