1

I have a table with a tranaction date and a transaction price. Like so:

  • 12/01/08 $1500
  • 20/05/08 $1200
  • 09/08/15 $2000
  • 12/09/15 $3000

I want to be able to find the sum of transactions for each year. How do I add them together. I only know how to add example + example as "example".

Select transaction_id, transaction_date, transaction_amount from transactions_table

Thanks!

user3452963
  • 117
  • 2
  • 4
  • 15
  • You should be able to find your answer, in two parts, in the following questions: http://stackoverflow.com/q/6105767/3004881 and http://stackoverflow.com/q/508791/3004881 – Dan Getz Jun 19 '15 at 23:12

1 Answers1

0

You'll need something like:

SELECT SUM(transaction_amount), transaction_date
FROM transaction_table
GROUP BY YEAR(Transaction_date)

This will sum up all transactions and group them by year.

Darren
  • 68,902
  • 24
  • 138
  • 144