vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi all I have a table with some date on it i need to get the 5 most recent one but ordered in ASC SELECT date FROM `table` order by `date` DESC limit 5 this get the most recent ok but now I've to reorder the result. I'm thinking of make a temp table where I will put all the result and then reorder it but i don't see it as a great solution. I have found another solution SELECT * FROM `table` where date > (SELECT `date` FROM `table` order by `date` DESC limit 5,1 ) order by `date` ASC This does the job however there is any way to get the result of the subquery as a variable and pass it to the next query ? Thanks a lot for any idea Daniele |
| Thread Tools | |
| Display Modes | |
|
|