SQL查询指定行数的数据

2024-12-29 17:13:57
推荐回答(5个)
回答1:

select top 10 * from 表名 where id not in (select top 10 id from 表名 Order by ID) Order by ID
如果是用Top语句的话,最好是加上Order by语句,否则你出错了都不知道错在哪..

回答2:

select * from (select rownum rn,表名.* from 表名)
where rn between 10 and 20

回答3:

select top 20 * from 表名 where id not in (select top 10 id from 表名)

回答4:

(mysql)select * from 表名 order by 列名 limit 9,10;
(oracle)select top 20 * from 表名 order by 列名 where exists (select top 10 * from 表名 order by 列名);

回答5:

select top 10 * from 表名 where ID not in (select ID top 10 from 表名)