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? 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 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. 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. Link to comment https://forums.phpfreaks.com/topic/73223-solved-sql-query-help/#findComment-369417 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.