“翻页查询,使用哪个查询更好,Query 1还是Query 2?”
Query 1:
select CEILING(CONVERT(decimal,Count(*))/@PageSize) as TotalPages FROM Table
Query 2:
Select (Count(*) + @PageSize - 1)/@PageSize as TotalPages FROM Table