sqlserver分页查询语句
select *
from (
select *,ROW_NUMBER() over(order by id) rownum
from table_name
) t
where t.rownum between 1 and 10
mysql分页
select * from table_name limit(curPage-1)*pageSize,pageSize;
oracle分页查询语句
SELECT *
FROM (
SELECT a.*, ROWNUM AS rn
FROM (
SELECT *
FROM table_name
) a
)
WHERE rn BETWEEN 1 AND 10
EF Lambda
Skip跳过多少条,Take取多少条
var query = db.UserContracts.AsNoTracking();
var total = query.Count();
var list = query.OrderByDescending(q => q.CreateTime).Skip((page - 1) * pageSize).Take(pageSize).ToList();