需要有关键字的,如果关键字为n_id,你可以看到对应找到数据的行号 select *,(select count(*) from tb_test where n_id<=a.n_id) from tb_test a where (select count(*) from tb_test where n_id<=a.n_id)>5
select top 5 * from tb_abc SELECT IDD=IDENTITY(INT,1,1),* INTO #T FROM tb_abc SELECT * FROM #T WHERE IDD>5
不就和翻页一样么? select * from tb_abc where 主键 not in (select top 5 主键 from tb_abc )
select * from tb_abc where id not in (select top 5 id from tb_abc )
有唯一字段么?有唯一字段用子查询就能实现,没有的话用临时表添加1个identity列,然后再查询
select * from tb_abc where id not in (select top 5 id from tb_abc ) 用子查询就能实现。
select top 5 * from tb_abc 楼主你就用总记录减去它吗
select * from (select id=row_number()over(order by getdate()),* from tb)t where id>5
select * from tb where id not in (select top 5 id from tb)--orselect * from tb t1 where not exists (select top 5 from tb t2 where t1.id=t2.id)
select *,(select count(*) from tb_test where n_id<=a.n_id) from tb_test a
where (select count(*) from tb_test where n_id<=a.n_id)>5
select * from tb_abc where 主键 not in (select top 5 主键 from tb_abc )
楼主你就用总记录减去它吗
*
from
(select id=row_number()over(order by getdate()),* from tb)t
where
id>5
select * from tb where id not in (select top 5 id from tb)--orselect * from tb t1 where not exists (select top 5 from tb t2 where t1.id=t2.id)