I am somehow stuck with this one:
I have a table with mutliple payments which have a date and a staff_id.
I want to get the sum of the payments for every staff_id for every year.
2011 - Staff1 - 66$
2011 - Staff2 - 24$
2012 - Staff1 - 86$
2012 - Staff2 - 0$
SELECT YEAR(p.payment_date), staff_id, sum(p.amount) FROM payment p GROUP BY YEAR(p.payment_date), staff_id