Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Douglas Wilson — — source: Informix-list mailing list archive (1991-1998)
Toby Denbow wrote:
>
> 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
Off the top of my head so I don't know if this will work:
create a temp table (or temporarily create a permanent table)
with a serial column as the first field, the other fields like
tab1 above.
insert into tmp_tab select 0,tab1.* from tab1 where ...
(if you need an order by i don't know if its allowed here)
select <fields you want> from tmp_tab where serial_field<50
If you're using 4gl, you'd just declare a cursor and fetch 50 times.
--
Sincerly,
Doug Wilson(dougw@amgen.com)
*** The opinions expressed here are my own and not neccessarily ***
*** anyone elses ****
*** Disclaimer: These are the opinions of the poster not Amgen Inc.***
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.