I have two tables in my database first saveimage which contains id and url of each image second score which contains id and score of each image this scores are not unique - each row in score table is user rating to a image so one image may has several rows in score.
Now I want find images with highest score in database
I tried
select * from saveimage
where saveimage.id in (select top 100 id,SUM(avgscore)
from score
group by id
order by SUM(avgscore) desc)
Which is not working because
Only one expression can be specified in the select list
So what can i do?