Database Administration (MOSC)

MOSC Banner

applying paging to join queries

edited Jan 30, 2009 8:03AM in Database Administration (MOSC) 3 commentsAnswered
Hi,
I'd like to apply paging (skip the first $offset entries and provide $maxresults entries) to my query.
Investigating this brought up this sql statement:

  select * from (SELECT paging.*, rownum rn FROM ([usual sql goes here]) paging where rownum <= :paging1) where rn > :paging0

Unfortunately there is now a discrepancy between the number of entries expected and the number of rows returned.
While this method gives you exactly $maxresults rows, I really want to limit the amount of returned entries of the main table.

Let's say the sql without paging looks like

  select * from tree t left join leave l on t.id=l.id

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center