SQLServier 分页查询:
一种思想是除去不要的进行查询:
select top 3 * from tblSheet where ID
not in
( select top ((2-1)*3 ) id from tblsheet order by id)
order by id
另一种思想是:
通过row_number 关键字
select * from(
select *,ROW_NUMBER() over(order by id) as num from tblSheet)t
where t.num between 3 and 5;
但是值得注意的是sqlServer是分页是从1开始的。
MySql分页
select * from goods limit 0,4 从第0条开始查询四条。
Oracle分页:
select a1.* from (select student.*,rownum rn from student) a1 where rn >5;
select * from (select a1.*,rownum rn from (select * from student) a1 where rownum <=5) where rn>=2;