SELECT imagename, SUM(ratingvalue) as "lol"
FROM ratings
GROUP BY imagename;
How do I go about grabbing the total of a specific imagename
so i can then display it onto the page, so for example instead of returning the results for all 12 image name's i want to be able to limit that down to one specific imagename. I would be able to do this if I could use the WHERE
statement but I realise you cannot do that with aggregate functions.
Any ideas on how I can implement WHERE imagename = '{$imgname}'
in the above SQL query?
Basically I'm looking for an alternate method to WHERE
.