sql分页如何用exists替换not in???
SELECT TOP 5 *FROM tableWHERE (id NOT IN (SELECT TOP 10 id FROM table))
goif OBJECT_ID('test')is not nulldrop table testgocreate table test(id int identity(1,1),value int)godeclare @b intset @b=1while @b<100begininsert testselect @bset @b=@b+1endSELECT TOP 5 *FROM testWHERE (id NOT IN (SELECT TOP 15 id FROM test))/*id value16 1617 1718 1819 1920 20 */ SELECT TOP 5 *FROM test bWHERE not exists(select 1 from(select top 15 id from test)a where b.id<=a.id)/*id value16 1617 1718 1819 1920 20*/