Use a "group by" query to get all your totals at once.
SELECT YEAR(date) as year, SUM(amountraised) AS year_total
FROM fundraisingtotal
GROUP BY YEAR(date)
SorcyCat
2010-01-27 20:22:39
Use a "group by" query to get all your totals at once.
SELECT YEAR(date) as year, SUM(amountraised) AS year_total
FROM fundraisingtotal
GROUP BY YEAR(date)
SELECT a.year , SUM( f.amountraised ) , a.target
FROM annualtarget a INNER JOIN fundraisingtotal f ON (a.year = YEAR( f.date ))
GROUP BY a.year