lemmin Posted June 13, 2008 Share Posted June 13, 2008 I really doubt this is possible, but is there a way to order by the same order as a set? For example: SELECT * FROM Table WHERE ID IN (1,4,2,7,5); The ID's would be unique so five rows would be returned and I would want them to be in the order that is specified in the set. Is there anyway I can do something like this? Thanks for any help. Link to comment https://forums.phpfreaks.com/topic/110096-solved-order-by-a-set/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 13, 2008 Share Posted June 13, 2008 See this link - http://www.eklekt.com/tutorials/mysql Link to comment https://forums.phpfreaks.com/topic/110096-solved-order-by-a-set/#findComment-565038 Share on other sites More sharing options...
lemmin Posted June 13, 2008 Author Share Posted June 13, 2008 Wow, I don't even understand why that works. Thanks for showing me that. Link to comment https://forums.phpfreaks.com/topic/110096-solved-order-by-a-set/#findComment-565056 Share on other sites More sharing options...
fenway Posted June 13, 2008 Share Posted June 13, 2008 Actually, that doesn't entirely work as advertised if there are non-matching items to be ordered... Link to comment https://forums.phpfreaks.com/topic/110096-solved-order-by-a-set/#findComment-565098 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.