Lamez Posted December 31, 2008 Share Posted December 31, 2008 I am trying to create a mysql query with two order bys, and I am lost. I want to order by the sticks first, then by the ids, and I am getting every forum topic sticky'ed, and locked. here is my code: <?php $sql = "SELECT * FROM mb ORDER BY id AND sticky DESC"; $result = mysql_query($sql); ?> Quote Link to comment https://forums.phpfreaks.com/topic/138980-solved-two-order-bys/ Share on other sites More sharing options...
GingerRobot Posted December 31, 2008 Share Posted December 31, 2008 You need to use a comma to separate the things you wish to order by, not AND. Quote Link to comment https://forums.phpfreaks.com/topic/138980-solved-two-order-bys/#findComment-726851 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.