CyberGuru Posted June 22, 2011 Share Posted June 22, 2011 I am using the following query to retrieve the last 20 results of my database, but I need them not to be in descending order. Is there anyway I can accomplish this with the query or do I need to handle it in php? Thanks for your help. SELECT * FROM messages ORDER BY id DESC LIMIT 0,20 Link to comment https://forums.phpfreaks.com/topic/240076-help-reversing-query-results/ Share on other sites More sharing options...
CyberGuru Posted June 22, 2011 Author Share Posted June 22, 2011 I got it sorted it, changed my SQL to the following did the trick. SELECT * FROM (SELECT * FROM tablename ORDER BY tablecolumn DESC LIMIT 5) AS RequiredLimit ORDER BY tablecolumn ASC Link to comment https://forums.phpfreaks.com/topic/240076-help-reversing-query-results/#findComment-1233201 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.