淘先锋技术网

首页 1 2 3 4 5 6 7
mysql每日分组查询,mysql中按照日期分组查询数量?

SELECT DATE_FORMAT(time,'%Y-%m-%d') as day, sum(case when amount>0 then amount when amount=0 then 0 end) as amount1from table where time>='2014-11-01' group by day;我没有测试。time表示日期,amount表示数量。查询11月后每天成交数量