我想要从从表中查出每天电动车和手机各自的销售总额。这个需求还是蛮简单的,只需要根据createtime和pro
duct group by就行了。下面是我写的SQL语句:
SELECT DATE_FORMAT( createtime, "%Y-%m-%d" ) cr, product, SUM(price) total FROM orders GROUP BY
DATE_FORMAT(createtime, "%Y-%m-%d"), product
1
查询结果如下:
[attach]113342[/attach]