CodeIgniter Forums
star rating system get top 10 records - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: star rating system get top 10 records (/showthread.php?tid=44897)



star rating system get top 10 records - El Forum - 08-30-2011

[eluser]harman[/eluser]
hi please help me in this problem it's not CI related its General SQL please help me to over come this problem

i am creating star rating system i can calculate the total votes, avg. rating but now i need top rated 10 items how can i calculate rating weight-age : here is my db table

Code:
id   rating     product_id
1    5          120    
2    2          120    
3    2          120
4    4          25    
5    5          25


in short: can anybody provide me SQL query to calculate top 10 rated items