Re: SELECTing first x results (a FAQ?)
Posted in 1998
Hi !!!
you can use following SQL script...
CREATE TABLE TEMP_T <same as table form which u want to select rows>;
INSERT INTO TEMP_T AS
(SELECT * FROM main_table);
SELECT * FROM TEMP_T
WHERE rowid < (SELECT MIN(rowid) + <no of rows to be selected say 50>);
if ur main_table's rowid is serial than u can directly use above query
without creating temp table.
On Fri, 11 Sep 1998, D. Sanderson wrote:
>
> Despite the fact that this is probably a common question, all the usual
> sources (Informix manuals, Informix and SQL FAQs, DejaNews) came up empty.
> (I apologize ahead of time, particularly because I'm pretty sure I *did*
> see this in a manual somewhere, but I just can't find it now.)
>
> I want an SELECT statement that returns the first x results (x being a
> constant, say, 50) matching certain criteria. (I want an exact number, so
> I can't use the 'fraction of' formula in the FAQ.)
>
> Our client uses a port (just one) to get to the database, and I don't want
> a broad user-specified search to tie up the port getting hundreds of
> results.
>
> Many thanks for any assistance you can provide!
>
> _____________________________________________________________________
> Dan Sanderson dsanders@u.washington.edu
> University of Washington http://weber.u.washington.edu/~dsanders
>
>