Somk
Somk

Reputation: 12047

MySQL SUM only 1 field and

I have the following table structure

--ID-- --Date-- --Value--
  1    2013-1-2     23
  2    2013-1-2     11
  3    2013-1-3     8
  4    2013-1-3     7

As you can see the dates can overlap and I want to output every different date with a summation of the values attributed. So for this it would be.

--Date--   --Total-- 
2013-1-2      34 
2013-1-3      15

Is this even possible with a query or will I have to do some seperate summation?

Upvotes: 0

Views: 44

Answers (1)

letiagoalves
letiagoalves

Reputation: 11302

SELECT Date, sum(Value) as Total
FROM Table
GROUP BY Date

Upvotes: 1

Related Questions