Doug that will work for the initial query but he's wanting page progression... to display rownums between 1 and 25 for example.. That example wont work in this case.. SELECT * FROM ( SELECT * FROM DOCUMENTS ORDER BY title ) WHERE ROWNUM > 20 AND ROWNUM < 30
yields no results.. However if you create the variable with the inner query and pass it to the outer query then it works. IE.. SELECT * FROM ( SELECT d.*, ROWNUM r FROM DOCUMENTS d ORDER BY title ) WHERE r > 1 AND r < 25 On Thu, 20 Jan 2005 09:24:02 -0500, Douglas Knudsen <[EMAIL PROTECTED]> wrote: > for a TOP N SQL in Oracle... > > SELECT * > FROM > ( SELECT * > FROM tablename > WHERE foo = goo > ORDER BY columnname > ) WHERE rownum <= N > > Note where the order by appears, its important to sort the results > first, then nab the top N. > > Doug > > > On Thu, 20 Jan 2005 07:31:31 -0600, Greg Morphis <[EMAIL PROTECTED]> wrote: > > Well good, then use what I wrote.. > > This is for Oracle. > > > > SELECT * > > FROM > > ( > > SELECT ROWNUM rID, d.* FROM DOCUMENTS d > > ORDER BY docid > > ) b > > WHERE b.rID BETWEEN 2 AND 8 > > > > > > On Thu, 20 Jan 2005 08:26:19 -0400, daniel kessler <[EMAIL PROTECTED]> > > wrote: > > > When I try to run this SQL, I receive the error > > > FROM keyword not found where expected > > > SELECT TOP 25 t1.* FROM (SELECT TOP 50 > > > service_population,agency,city,state,salary_status,int_agency_id FROM > > > internships) t1 > > > > > > If I remove the TOP 25 and TOP 50 it runs fine, but of course it doesn't > > > do what I need once I remove them. I'm using Oracle and can't find Top > > > in my reference, which isn't the best reference. > > > > > > >SELECT TOP 25 t1.* > > > >FROM > > > >(SELECT TOP 50 > > > >service_population,agency,city,state,salary_status,int_agency_id > > > >FROM internships > > > >#preservesinglequotes(find_text)# > > > >ORDER BY agency DESC) t1 > > > >ORDER BY t1.agency ASC > > > > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware: 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:191187 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=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54