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. 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 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 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
Archived
This topic is now archived and is closed to further replies.