문제

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

도움이 되었습니까?

해결책

you can use subquery :

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

다른 팁

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top