aebstract Posted April 12, 2010 Share Posted April 12, 2010 I have 3 columns of numbers that go with a user. I want to display the list of users in order based on these numbers, but I want user 1 to be the person with the lowest number, throughout all 3 fields. So on and so on for the rest. I obviously know how to do it for one column ORDER BY column, but is there a built in function or simple way to order by the lowest of the three fields per individual? Thanks Link to comment https://forums.phpfreaks.com/topic/198275-order-by/ Share on other sites More sharing options...
JustLikeIcarus Posted April 12, 2010 Share Posted April 12, 2010 Try the least() function select * from tabe order by least(col1, col2, col3) Link to comment https://forums.phpfreaks.com/topic/198275-order-by/#findComment-1040324 Share on other sites More sharing options...
aebstract Posted April 12, 2010 Author Share Posted April 12, 2010 Sweet, I'll be giving it a try in the next hour or so. Thanks! Link to comment https://forums.phpfreaks.com/topic/198275-order-by/#findComment-1040339 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.