Question

This is kind of straight forward. I want to ORDER BY date DESC Limit 4 and then I want to ORDER BY date ASC on that result, so just 4-games from the middle of the big table with ASC date order, any ideas? Just ORDER BY date ASC Limit 4 Does not work!

What I have: enter image description here

What I get: enter image description here

What I want: enter image description here

Was it helpful?

Solution

you can use subquery :

SELECT a.* FROM (SELECT * FROM yourtable ORDER BY date DESC Limit 4) a ORDER BY a.Date 

OTHER TIPS

if you want to get the last four rows from table

select * from table  order by date desc limit 0,4

if you want to get the first four rows from table

select * from table  order by date asc limit 0,4
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top