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

 

 



相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-29
  • 2021-08-13
  • 2022-12-23
  • 2021-11-16
猜你喜欢
  • 2021-05-20
  • 2021-07-20
  • 2022-12-23
  • 2021-07-07
  • 2022-12-23
  • 2022-12-23
  • 2021-09-30
相关资源
相似解决方案