SQL中查询表中第10--100条之间的数据怎么写?

如题所述

这个主要是看你用的哪个数据库了
不同的数据库有差异。
在mysql和oracle里面用如下方法最简单
select * from table LIMIT 10,100;

而在sqlserver中由于不支持limit只用其他方法啦:
当此表有主键时:
select top 100 * from 表 where 主键 not in(select top 10 主键 from 表)
如果表中无主键:
可以用临时表,加标识字段解决.这里的x,y可以用变量.
select id=identity(int,1,1),* into #tb from 表
select * from #tb where id between 10 and 100
温馨提示:答案为网友推荐,仅供参考