如何从同一日期加入总和(美元)并在MySQL和PHP中按日期显示它们?
ID = auto_increment
我想结果是这样的
2012-01-14 - 48
2012-02-21 - 19
2012-02-25 - 31
2012-03-01 - 11
答案 0 :(得分:3)
SELECT date, SUM(dollar)
FROM tableName
GROUP BY date
答案 1 :(得分:2)
SELECT `DATE`, SUM(`DOLLAR`) FROM your_table GROUP BY `DATE`;