mishuk Posted April 18, 2007 Share Posted April 18, 2007 Is it possible to order the results of an sql statement by specifying which value you want at the top of the list and the rest can be in any order. For example if i had a table that had the values 1 - 10 in them and i wanted to select each value but wanted the value 5 at the top followed by the rest. e.g 5 1 2 3 4 6 7 and so on Is this possible in any way? Quote Link to comment https://forums.phpfreaks.com/topic/47492-solved-order-by-statement/ Share on other sites More sharing options...
bubblegum.anarchy Posted April 18, 2007 Share Posted April 18, 2007 This query seems to work: SELECT * FROM table_name ORDER BY id = 5 desc, id Quote Link to comment https://forums.phpfreaks.com/topic/47492-solved-order-by-statement/#findComment-231800 Share on other sites More sharing options...
mishuk Posted April 18, 2007 Author Share Posted April 18, 2007 just what i wanted. Cheers Quote Link to comment https://forums.phpfreaks.com/topic/47492-solved-order-by-statement/#findComment-231802 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.