Re: SQL: How to select first N rows?
Posted in 1997
Sally Woolrich wrote: > In article <66h1l9$pj1@cssun.mathcs.emory.edu>, James T Ford > <James_T_Ford@fleet.com> writes > > is this a synonym for greasy??? > > > > > > anyhow - for this problem > > select rows into a temp table with a serial column > > select from temp where serial < # > > > This *will* select the first N rows - but the query will have to run to > completion to populate the temp table which may take some time! > > -- > Sally Woolrich > My Email address has been altered to limit junk mail. > Please remove the second 'x' in the company name to Email me. I have been following this thread, and it seems there is no definitive answer. Of-course ORACLE has the pseudo column ROWNUM in all database tables, so all you need do is add the condition "ROWNUM < N" in the WHERE clause of your query. A small thing, but extremely useful - IMHO. Cheers, Avi. ************************************************************************ /\\ \\ /| Avi Abrami, Analyst/Programmer, Telegate Ltd. /__\\ \\ / | 7 Haplada Street, Or-Yehuda, ISRAEL / \\ \\/ | Phone:+972-3-5388717 Fax:+972-3-5335877 eMail:avia@telegate.co.il