ReiOtome Posted March 9, 2008 Share Posted March 9, 2008 I've been dealing with this for a while now... I got a site where people can rate websites... If you rate a website it is put in the db like this... Database name is Rating Rating_id Website_id User_id Rating Now I need to get the 10 highest scores... The problem is that the user_id can be in the db several times... If got like 5 times user id 5 in it... How can I select the user_id's just once... so that I won't get 5 times the same user_id I hope I made some sense... and i hope someone can help me with this... if somethings unclear I'll try and explain it beter Link to comment https://forums.phpfreaks.com/topic/95226-highest-10/ Share on other sites More sharing options...
fenway Posted March 10, 2008 Share Posted March 10, 2008 Just run a query, get MAX(score), GROUP BY user_id, ORDER BY score DESC LIMIT 10. Link to comment https://forums.phpfreaks.com/topic/95226-highest-10/#findComment-488491 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.