SELECT * FROM (SELECT A.*, ROWNUM RN FROM (
select * from table_name t
) A WHERE ROWNUM <= 200*1 )WHERE RN >0
SELECT * FROM (SELECT A.*, ROWNUM RN FROM (
select * from table_name t
) A WHERE ROWNUM <= 20*20--- bigRowNum
WHERE RN >20*10--- smallRowNum
SQSERVER:
select top 200 from table_name
select top 200 rownum as r from table_name where r>200
MYSQL:
select * from table_name limit 0,200--startrow,pagesize
select * from table_name limit 200,200--startrow,pagesize
对的,你说的对,但是rowCount 不行吧,我一直用rownum,是了一下rowCount也不行,但是建议你这样写:select /*+first_rows(10)*/ b.* from
(select /*+first_rows(10)*/ a.*,rownum rnum from
(select /*+first_rows(10)*/ * from student ) a where rownum<= "+currentPage*pageSize+"
)b
where rnum>= (currentPage-1)*pageSize;
这个意思就是认为的在sql中添加hint 数据库返回指定条目的数据是最快的。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)