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.
Xavi Cheto — — source: Informix-list mailing list archive (1991-1998)
Cosmo Lee <"* N O - S P A M * cosmo"@echonyc.com> escribi' en art'culo
<347780AD.D83651DE@echonyc.com>...
> Is there a way to select the first N rows from a table?
>
> i.e.: select the first 20 row from a table
>
Try :
SELECT field FROM table t1
WHERE 20 > ( SELECT COUNT(*) FROM table t2
WHERE t1.field > t2.field )
ORDER BY field
This selects the first 20 records of the following SELECT :
SELECT field FROM table
ORDER BY field
Hope that helps.
Xavi
Your privacy choices
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.