I could do both <= and >= at the end like Deanna (it is just the >= that
fails in the 2nd query). I do the <= in the 2nd because the result set
returned from that query is likely to be smaller than if I do it in the
3rd query. The end result is exactly the same

You need 3 queries because ROWNUM is assigned before the ORDER BY and
you can't do "ROWNUM >= x" (this will simply be ignored)

SO:
1st query => get all possible records sorted
2nd query => create a query with ROWNUM saved in it (RN)
3rd query => get the rows you need (using RN to filter)

Pascal

> 
> In this setup, it all works great, at least for 1 through 10 but it's
an
> example.  The second step "SELECT t.*, ROWNUM AS RN" does the trick.
I'm
> not sure why this works though.  Pascals does the WHERE differently in
> that one part of the WHERE is in the middle (2nd) query.  The order of
the
> WHERE appears to be necessary in this way, rather than having both
parts
> of the WHERE at the end.
> 
> - So, I get the whole recordset and alphabetize, which I'd done
before.
> - Then, I take that recordset and grab the whole thing again, but this
> time get a ROWNUM.  This doesn't seem to adjust the record set at all,
but
> gives it the variable information of rownum.  In Pascal's version the
> WHERE end_num is done here.
> - The outter-most query does the paging part and in Pacal's it
finishes
> the WHERE with the begin_num part.
> 
> I guess I really don't understand enough of this query to reproduce or
use
> as programming knowledge in the future.  I don't see why this
alphabetizes
> it better since both do the ordering at the same level.  I don't see
how
> adding the middle query adjusts things.  It'd be nice to get this a
little
> better and not have to ask so many questions in the future.
> 
> and oh, thanks alot for the assistance.
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:192081
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to