在按‘id’字段排序的20行中,取出按'weight'字段排序的五行。
|
1
MSSQL版本:SELECT TOP 5 * FROM table ORDER BY id, weight
MySQL版本:SELECT * FROM table ORDER BY id, weight LIMIT 5 |
|
aiskJan 15, 2013
3
select * from xxx where id in (select id from xxx order by id limit 20) order by weight order by weight limit 1 offset 5;
|
|
4
我想了下难道需要先查出行数 x 然后where id>(x-20) order by weight?
|
|
napoleonuFeb 8, 2013
5
select * from (select * from tb order by id limit 20) t1 order by weight limit 5;
|