Re: SQL: How to select first N rows?
Posted in 1997
Sally Woolrich (sally.woolrich@exxcelsis.co.uk) 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! It depends on what you mean by "first N rows". This query cannot guarantee the actual order of the rows unless you either access it with an order by or in some way through an index. BTW....name the column something other than "serial". joe : -- : Sally Woolrich : My Email address has been altered to limit junk mail. : Please remove the second 'x' in the company name to Email me. -- --------------------------------------------------------------------------- Joe Lumbley(jlumbley@netcom.com) author of: "INFORMIX DBA Survival Guide" Slaving away on "INFORMIX DEBUGGERS Survival Guide", available early 1998 from Prentice Hall/Informix Press. If you have debugging tips, tools, or ideas to share, please send me some e-mail. ---------------------------------------------------------------------------