i friend i have a database table
amount_id, year, amount,
and data like this
1 2002 2
2 2002 3
3 2007 2
4 2004 6
5 2004 10
i wan to run a query to select data like this
2002 4
2007 2
2004 16
thanks for help
i friend i have a database table
amount_id, year, amount,
and data like this
1 2002 2
2 2002 3
3 2007 2
4 2004 6
5 2004 10
i wan to run a query to select data like this
2002 4
2007 2
2004 16
thanks for help
It looks like you need to use a sum(amount) in your select statement and group by year after your where.
SELECT `year`, SUM(amount)
FROM databasetable
GROUP BY `year`
Should be all you need.