scottrohe Posted September 4, 2006 Share Posted September 4, 2006 Hey guys, having some trouble with my logic CAUSE I SUCKKK.Anyways,Here's what i'm trying to do. I have a Rating system (0-5 stars). I want to display the 'Top Rated Layouts' when I 'ORDER BY ranking' it works but it displays the first layouts that have been rated with 1 vote / 5 stars.. So, what I need it to do is display the actual TOP rated layouts for example.. If a layout has 3 votes, and its average ranking is still 5 stars, obviously it's better than the layout that has only 1 vote with 5 stars. I have tried 'ORDER BY (ranking*votes)' but that bumps say a layout with a average ranking of 4.80, with 3 votes to the second position above a layout that has like 2 votes with a 5.00 ranking average.What am I doing wrong in my logic (I suck at math.)? What do I order by? Thanks for your time. Link to comment https://forums.phpfreaks.com/topic/19643-easy-question-logic-help/ Share on other sites More sharing options...
Barand Posted September 4, 2006 Share Posted September 4, 2006 SELECT ranking, votes FROM mytable ORDER BY ranking DESC, votes DESC Link to comment https://forums.phpfreaks.com/topic/19643-easy-question-logic-help/#findComment-85570 Share on other sites More sharing options...
scottrohe Posted September 4, 2006 Author Share Posted September 4, 2006 Outstanding, it works. Thanks. Link to comment https://forums.phpfreaks.com/topic/19643-easy-question-logic-help/#findComment-85572 Share on other sites More sharing options...
corbin Posted September 4, 2006 Share Posted September 4, 2006 Oh, wow didnt realize you could double order things like that... Pimp... haha glad i read this post :P Link to comment https://forums.phpfreaks.com/topic/19643-easy-question-logic-help/#findComment-85573 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.