我有一个名为comments的表。我想按时间的升序检索最后3行。以下查询按时间降序获取它。我该怎么做才能得到想要的结果?
select * from comments where id=1 order by time desc limit 0,3
答案 0 :(得分:0)
使用子查询:
select c.*
from (select c.*
from comments c
where id = 1
order by time desc
limit 0, 3
) c
order by time asc;