日期:2014-05-16 浏览次数:20798 次
select * from (select * from `tab` order by `id` desc limit 5 ) a where name ='eee';
------解决方案--------------------
select * from (select * from 这个表 order by id desc limit 5) t where name='eee'
------解决方案--------------------
select t.id,name from tab t INNER JOIN (select id from `tab` order by `id` desc limit 5
) a ON a.id=t.id where name ='eee';
------解决方案--------------------
2楼已经回复你了,不过效率问题,就得看你的这条语句运行的频繁不频繁了。