robert_gsfame Posted October 26, 2009 Share Posted October 26, 2009 Let say i have 100 records and displayed in one page, then i want to get the records from 50-100 and use ORDER BY to re-order whether DESC or ASC How can i do the ORDER BY without re-order first 50 records (0-49)... I've tried LIMIT 49,50 but it still re-order the first 50 records... anyone has a clue? Quote Link to comment https://forums.phpfreaks.com/topic/179027-solved-how-to-separate-records-and-order-by/ Share on other sites More sharing options...
kickstart Posted October 26, 2009 Share Posted October 26, 2009 Hi SELECT * FROM (SELECT * FROM sometable ORDER BY aCol LIMIT 50,100) a ORDER BY anotherCol All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/179027-solved-how-to-separate-records-and-order-by/#findComment-944591 Share on other sites More sharing options...
robert_gsfame Posted October 26, 2009 Author Share Posted October 26, 2009 thx kickstart!!! can you explain the query to me please Quote Link to comment https://forums.phpfreaks.com/topic/179027-solved-how-to-separate-records-and-order-by/#findComment-944667 Share on other sites More sharing options...
kickstart Posted October 26, 2009 Share Posted October 26, 2009 Hi It is just doing one query to get the records you are interested in, and then doing a select from that query to get them into the order you want them in. The a floating around is just an alias name for the sub query as MySQL insists on subqueries being named. All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/179027-solved-how-to-separate-records-and-order-by/#findComment-944670 Share on other sites More sharing options...
robert_gsfame Posted October 26, 2009 Author Share Posted October 26, 2009 okay, appreciate your helps!!! THanx so much.. ;D Quote Link to comment https://forums.phpfreaks.com/topic/179027-solved-how-to-separate-records-and-order-by/#findComment-944674 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.