Database

Oracle paging 쿼리

rajent 2010. 3. 12. 10:41
728x90


select rownum as rnum, dbid,id,product_category,product_group,submit_date 
from
    (select rownum as rnum, dbid,id,product_category,product_group,submit_date
    from
        (select T1.dbid,T1.id,T2.product_category,T1.product_group,T1.submit_date
        from Defect T1,product_category T2 
        where 조건절
        order by id
    )
where rnum > 10 and rnum <= 20
order by rnum asc

오라클에서 페이징할때 사용하는 쿼리.

요걸 응용해서 페이징 단위만큼 증가시켜주면 된다.

mssql은 Top을 이용하거나 이와 유사한 방식이 존재하니 그에 참고하면 되겠다.

이걸로 몇일을 고생한건지..