1. The most efficient, restricted by the primary key being one, and the primary key is a number or can be converted into two segments.CodeConsistent, the first part is used for reading, and the second part is used for Ctrl + CProgram. Use string to replace the fields between % and %.
Select top % page size % * from % table name % Where % primary key %> (select isnull (max (% primary key %), 0) from (select top % page size % * (% PAGE %-1) % primary key % from % table name % where 1 = 1 and (% customer condition %) order by % primary key %) A) and (% customer's condition %) order by % primary key %
Select top % page size % * from % table name % Where [% primary key %]> (select isnull (max ([% primary key %]), 0) from (select top % page size % * (% PAGE %-1) [% primary key %] From % table name % where 1 = 1 and (% customer condition %) order by [% primary key %]) A) and (% customer's condition %) order by [% primary key %]
2. High Efficiency, no restrictions, the same two
Select top % page size % * from % table name % Where % primary key % not in (select top % page size % * (% pages %-1) % primary key % from % table name % where 1 = 1 and (% customer's condition %) order by % primary key %) and (% customer's condition %) order by % primary key %
Select top % page size % * from % table name % Where % primary key % not in (select top % page size % * (% pages %-1) % primary key % from % table name % where 1 = 1 and (% customer's condition %) order by % primary key %) and (% customer's condition %) order by % primary key %