sql = "select * from TABLE where id=‘“+id+”’";
sql = "select top "+PageSize.ToInt32() +" * from TABLE where id not in(select top " +
Convert.ToInt32((pageno-1)*PageSize) +" id from TABLE)";
示例:
Select top 10 *
from A
where a not in(select top 10 a from A) and b not in(select top 10 b from A)
not in 效率低,用left join 改写为:Select top 10 * from A x
left join (select top 10 a from A) y on x.a = y.a
left join (select top 10 b from A) z on x.b = z.b
where y.a is null and z.b is null