Hi, Here is a table:
-----------------------------
id | item | rating
-----------------------------
1 HTC 5
2 HTC 5
3 LG 4
4 LG 5
5 LG 4
6 LG 4
7 Sony 5
8 Sony 4

I want do divide the sum of rating by count of items to work out the average rating and show the top 2 results

SELECT id, COUNT(item) as NOI, (SUM(rating)/NOI) as IR FROM table GROUP BY item ORDER BY NOI, DESC LIMIT 2

Please help, i cant think anymore. ive been programming for over 12 hrs and im really tired. Thank you =)