EchoFool Posted June 10, 2010 Share Posted June 10, 2010 Hey, I need help, i trying to get my chat logs to get the the lastest 30 logs so i put ORDER BY Field DESC LIMIT 30 How ever this causes the newest log(highest) to be first. But as its a chat room (think IRC) i want the latest message to be at the bottom and older messages above it but still only load the LIMIT of 30. Any ideas on how to do this ? Quote Link to comment Share on other sites More sharing options...
Psycho Posted June 10, 2010 Share Posted June 10, 2010 I think this is what you are after: SELECT * FROM (SELECT * FROM table ORDER BY field DESC LIMIT 30) as last30 ORDER BY last30.field ASC Quote Link to comment Share on other sites More sharing options...
EchoFool Posted June 10, 2010 Author Share Posted June 10, 2010 Thanks! Quote Link to comment Share on other sites More sharing options...
James25 Posted June 14, 2010 Share Posted June 14, 2010 mjdamato -your answer heped me as well, tough my problem was a bit different Quote Link to comment 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.