[求助]关于不用游标查询第n行数据
本人查看了过去的一些文章有一个经典SQL语句中有这么一段:查询第xxx行数据
select *
from (select top xxx * from yourtable) aa
where not exists(select 1 from (select top xxx-1 * from yourtable) bb where aa.id=bb.i
运行这段代码的结果并不是查询第N行数据,希望各位帮忙看看,谢谢。
没错啊,你没贴全
Select
*
From
(
Select
Top xxx *
From
yourtable
) aa
Where Not Exists
(
Select 1
From
(
Select
Top xxx-1 *
From
yourtable
) bb
Where aa.id=bb.id
)