目前我有这个元数据prod_price
和date_purchase
(TIMESTAMP),我希望有这样的报道:
数据
记录1(prod_price:500,date_purchase:2015-07-08 21:40:15)
记录2(prod_price:500,date_purchase:2015-07-08 21:47:15)
记录3(prod_price:1000,date_purchase:2015-07-09 21:23:15)
记录4(prod_price:1000,date_purchase:2015-07-09 21:27:15)
记录5(prod_price:1500,date_purchase:2015-07-09 21:30:15)
记录6(prod_price:500,date_purchase:2015-07-09 21:53:15)
报告
********************************************** *
日期 ********** 总销售额
********************************************** *
08/07/2015 ***** $ 1000
09/07/2015 ***** $ 4000
提前致谢
答案 0 :(得分:0)
试试这个:
SELECT DATE_FORMAT(date_purchase,'%d/%m/%Y'), SUM(prod_price)
FROM $table
GROUP BY DATE_FORMAT(date_purchase,'%d/%m/%Y');