/*sql分页
pagenum 页数
pagerecord 每页记录数*/
--方法一:
select * from (SELECT t.student_code,
t.name,
t.sex,
t.identity,
row_number() over (order by t.student_code asc) as sortid
FROM test01 T, test02 T1
WHERE T.COLLEGE_CODE = T1.COLLEGE_CODE
and t1.of_province = '62'
and t.study_start = '20150901'
)
where sortid between &pagenum*&pagerecord-(&pagerecord -1)
and &pagenum*&pagerecord;
--方法二:
select *
from (select t.*, rownum
from (SELECT t.student_code,
t.name,
t.sex,
t.identity,
rownum as sortid
FROM test01 T, test02 T1
WHERE T.COLLEGE_CODE = T1.COLLEGE_CODE
and t1.of_province = '62'
and t.study_start = '20150901') t)
where sortid between &pagenum * &pagerecord - (&pagerecord - 1) and
&pagenum * &pagerecord;
pagenum 页数
pagerecord 每页记录数*/
--方法一:
select * from (SELECT t.student_code,
t.name,
t.sex,
t.identity,
row_number() over (order by t.student_code asc) as sortid
FROM test01 T, test02 T1
WHERE T.COLLEGE_CODE = T1.COLLEGE_CODE
and t1.of_province = '62'
and t.study_start = '20150901'
)
where sortid between &pagenum*&pagerecord-(&pagerecord -1)
and &pagenum*&pagerecord;
--方法二:
select *
from (select t.*, rownum
from (SELECT t.student_code,
t.name,
t.sex,
t.identity,
rownum as sortid
FROM test01 T, test02 T1
WHERE T.COLLEGE_CODE = T1.COLLEGE_CODE
and t1.of_province = '62'
and t.study_start = '20150901') t)
where sortid between &pagenum * &pagerecord - (&pagerecord - 1) and
&pagenum * &pagerecord;