我想每月和每周显示数据,我已经搜索了很多与此相关的内容,但我发现的内容并不能回答我的问题。这是我的表格的样子:
---------------
+ tblcomplain +
---------------
+ id +
+ status +
+ complain +
+ dateposted +
---------------
最佳答案
如果您的列是dateposted
,其类型为时间戳/日期时间:
对于每周报告:
select count(*) as totalWeeklycomplaints from tblcomplain group by week(dateposted);
对于月度报告:
select count(*) as totalMothlycomplaints from tblcomplain group by month(dateposted);
关于javascript - 如何在Mysql中生成月报表和周报表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49621924/