Re: How to limit # of rows returned by SELECT
From: <Fabien_Roy_at_free.fdn.org>
Date: 1996/03/13
Message-ID: <1996Mar13.215042.16976_at_free.fdn.org>#1/1
Date: 1996/03/13
Message-ID: <1996Mar13.215042.16976_at_free.fdn.org>#1/1
Fernando Nantes de Souza <nantes_at_amix.com.br> wrote:
> David wrote:
> >
> > >> : >> I tried SELECT *, COUNT(*) FROM TABLE WHERE COUNT(*) <=50
> > >> : >> but of course this didn't work, nor should it logically.
> >
> > You try again with:
> >
> > SELECT * FROM TABLE HAVING COUNT([field]) <=50
>
> There is a pseudo-column in Oracle that can help you. Try the following:
>
> SELECT * FROM TABLE WHERE ROWNUM <= 50;
What about:
set rowcount 50 (and "set rowcount 0" to return to the ulimited count)
-- Fabien Roy --------------------------------------------------------------------- Fabien_Roy_at_free.fdn.org (NextMail/MIME accepted) Fabien Roy Consultant NEXTSTEP/OPENSTEP/EOF Consultant, SYBASE DBA 10 rue de la DEFENSE 93100 MONTREUIL, France Tel: 33 1 45 28 32 23 Fax: 33 1 48 55 09 90Received on Wed Mar 13 1996 - 00:00:00 CET