mysql按月查询

SELECT DATE_FORMAT(GenerateTime, '%m') as month, SUM(GenerateCount) AS count FROM identitycodetask 
WHERE  DATE_FORMAT(GenerateTime, '%Y')='2019' AND ProductId='1'
 GROUP BY DATE_FORMAT(GenerateTime, '%Y-%m')

 

posted @ 2019-03-30 16:36  韩梦芫  阅读(4036)  评论(0编辑  收藏  举报