jck Posted July 15, 2007 Share Posted July 15, 2007 SELECT ItemID, avg(rating) as mr from dd_rating WHERE mr <= $Item_Rating group by ItemID ORDER by mr DESC LIMIT 1 Quote Link to comment https://forums.phpfreaks.com/topic/60071-what-is-wrong-with-this-query/ Share on other sites More sharing options...
ToonMariner Posted July 15, 2007 Share Posted July 15, 2007 If it doesn't work then yes... try SELECT ItemID, avg(rating) from dd_rating WHERE rating <= $Item_Rating group by ItemID ORDER by rating DESC LIMIT 1 Quote Link to comment https://forums.phpfreaks.com/topic/60071-what-is-wrong-with-this-query/#findComment-298776 Share on other sites More sharing options...
jck Posted July 15, 2007 Author Share Posted July 15, 2007 i think ur query takes to one with highest sum of votes.... if i am correct i need it to go to one with next highest avg votes Quote Link to comment https://forums.phpfreaks.com/topic/60071-what-is-wrong-with-this-query/#findComment-298782 Share on other sites More sharing options...
ToonMariner Posted July 15, 2007 Share Posted July 15, 2007 try LIMIT 1,1 then Quote Link to comment https://forums.phpfreaks.com/topic/60071-what-is-wrong-with-this-query/#findComment-299002 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.