按顺序查找一数据表中第5条记录至第10条记录
我只想查找第5条至第10条的记录
3 个解决方案
#1
select * from Kiss.dbo.mobile where id in (select top 10 id from Kiss.dbo.mobile)
and id not in (select top 5 id from Kiss.dbo.mobile)
and id not in (select top 5 id from Kiss.dbo.mobile)
#2
select * from TableName where id in (select top 10 id from TableName )
and id not in (select top 5 id from TableName )
and id not in (select top 5 id from TableName )
#3
select top 5 * from tablename where id not in (select top 5 id from tablename)
--
select top 5 * from tablename where id not in (select top (n-1)*5 id from table)
查询第n个5条记录
--
select top 5 * from tablename where id not in (select top (n-1)*5 id from table)
查询第n个5条记录
#1
select * from Kiss.dbo.mobile where id in (select top 10 id from Kiss.dbo.mobile)
and id not in (select top 5 id from Kiss.dbo.mobile)
and id not in (select top 5 id from Kiss.dbo.mobile)
#2
select * from TableName where id in (select top 10 id from TableName )
and id not in (select top 5 id from TableName )
and id not in (select top 5 id from TableName )
#3
select top 5 * from tablename where id not in (select top 5 id from tablename)
--
select top 5 * from tablename where id not in (select top (n-1)*5 id from table)
查询第n个5条记录
--
select top 5 * from tablename where id not in (select top (n-1)*5 id from table)
查询第n个5条记录