Fredrik
Fredrik

Reputation: 635

Join sum from same date

How do I join sums (dollar) from the same date and present them by date in MySQL and PHP?

My table looks like this

ID = auto_increment

I wan't the result to be like this

2012-01-14 - 48
2012-02-21 - 19
2012-02-25 - 31
2012-03-01 - 11

Upvotes: 1

Views: 108

Answers (2)

Brad
Brad

Reputation: 163430

SELECT `DATE`, SUM(`DOLLAR`) FROM your_table GROUP BY `DATE`;

http://www.tizag.com/mysqlTutorial/mysqlgroupby.php

Upvotes: 2

Stenerson
Stenerson

Reputation: 1002

SELECT date, SUM(dollar)
  FROM tableName
 GROUP BY date

Upvotes: 3

Related Questions