Michdd Posted December 4, 2008 Share Posted December 4, 2008 I have 2 rows in the database named Wins and Losses, now I want to take them from the database, divide one into another (getting their % of winning) then order the top 30 from greatest to least. Quote Link to comment https://forums.phpfreaks.com/topic/135487-ordering-after-taken-from-the-database/ Share on other sites More sharing options...
sasa Posted December 4, 2008 Share Posted December 4, 2008 SELECT * from `table name` where (Wins + Losses) > 0 ORDER BY Wins / (Wins + Losses) DESC LIMIT 30 Quote Link to comment https://forums.phpfreaks.com/topic/135487-ordering-after-taken-from-the-database/#findComment-705832 Share on other sites More sharing options...
Mchl Posted December 4, 2008 Share Posted December 4, 2008 SELECT *, (Wins / (Wins + Losses)) AS percentage from `table name` where (Wins + Losses) > 0 ORDER BY percentage DESC LIMIT 30 Quote Link to comment https://forums.phpfreaks.com/topic/135487-ordering-after-taken-from-the-database/#findComment-705890 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.