LemonInflux Posted October 14, 2007 Share Posted October 14, 2007 Just a quick question. I have a table like this: +-----------+-----------------------+ | item id | item | +-----------+-----------------------+ | 1 | blah1 | | 2 | blah2 | | 3 | blah3 | | 4 | blah4 | +-----------+-----------------------+ Awful diagram, sorry. Anyways, say this table goes on for, say, 60 records. Now, how do I show the first 30 records in reverse order. So, it would look like this: blah30 blah29 blah28 blah27 blah26 blah25 etc. until it reached blah1. How do I do this? Quote Link to comment https://forums.phpfreaks.com/topic/73223-solved-sql-query-help/ Share on other sites More sharing options...
pocobueno1388 Posted October 14, 2007 Share Posted October 14, 2007 SELECT * FROM table ORDER BY item_id DESC LIMIT 0,30 I'm pretty sure that will do it Quote Link to comment https://forums.phpfreaks.com/topic/73223-solved-sql-query-help/#findComment-369413 Share on other sites More sharing options...
LemonInflux Posted October 14, 2007 Author Share Posted October 14, 2007 thanks, I thought that, but then I wondered wether DESC LIMIT would just show the 30 newest, not the 30 oldest, in reverse order. Quote Link to comment https://forums.phpfreaks.com/topic/73223-solved-sql-query-help/#findComment-369415 Share on other sites More sharing options...
pocobueno1388 Posted October 14, 2007 Share Posted October 14, 2007 Yeah, thats why you have to order the item_id field DESC, so it will show up in reverse. Quote Link to comment https://forums.phpfreaks.com/topic/73223-solved-sql-query-help/#findComment-369417 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.