Re: SQL question (retriveing n number of rows)
Posted in 1996
Boris Niyazov — — source: Informix-list mailing list archive (1991-1998)
Try:
select * from tab1
where x = y
into temp tab2;
select * from tab2 a
where 50 > (select count(*) from tab2 b
where b.rowid > a.rowid)
For large enough tables it's better to use 4gl script to open a cursor and
retrieve 50 rows.
>How do I retrieve a set number of rows in a SQL select.
>
>If my select is something like:
>select * from tab1 where x = y.>
>how do I retrieve only the first 50 rows.
>
>-Toby Denbow
>tdenbow@mathworks.com
>
--
=======================================================================
Boris Niyazov Ph: 212-854-4094
IT Department Fax: 212-316-2623
Columbia Law School Email: ban5@columbia.edu