Subject RE: RES: [ib-support] Re: How to limit the nbr or rows returned by a Select statement
Author Thomas Steinmaurer
Jose,

from the Release Notes:

SELECT [FIRST (<integer expr m>)] [SKIP (<integer expr n>)]

Retrieves the first m rows of the selected output set. The optional SKIP clause will cause the first n
rows to be discarded and return an output set of m rows starting at n + 1. In the simplest form, m
and n are integers but any Firebird expression that evaluates to an integer is valid. A identifier that
evaluates to an integer may also be used in GDML, although not in SQL or DSQL.

Parentheses are required for expression arguments and optional otherwise.

They can also bind variables, e.g. SKIP ? * FROM ATABLE returns the remaining dataset after discarding
the n rows at the top, where n is passed in the "?" variable. SELECT FIRST ? COLUMNA, COLUMNB FROM
ATABLE returns the first m rows and discards the rest.

The FIRST clause is also optional, i.e. you can include SKIP in a statement without FIRST to get an
output set that simply excludes the rows appointed to SKIP.
Available in SQL and DSQL except where otherwise indicated.

Examples:
SELECT SKIP (5+3*5) * FROM MYTABLE;
SELECT FIRST (4-2) SKIP ? * FROM MYTABLE;
SELECT FIRST 5 DISTINCT FIELD FROM MYTABLE;


HTH,
Thomas.

> -----Original Message-----
> From: Jose Romero [mailto:jromero_arg@...]
> Sent: Tuesday, February 11, 2003 12:53 PM
> To: ib-support@yahoogroups.com
> Subject: Re: RES: [ib-support] Re: How to limit the nbr or rows returned
> by a Select statement
>
>
> With version of Firebird is Possible...
> I have Firebird SS 1.02 fro Linux
>
> >
> > You can use First or Skip.
> >
> > example:
> >
> > select first 10 from employee.
> >
> > this command return 10 rows.
> >
> > Marcelo
> >
> > > ----- Mensagem original -----
> > > De: Jose Romero [SMTP:jromero_arg@...]
> > > Enviada em: terça-feira, 11 de fevereiro de 2003 08:06
> > > Para: ib-support@yahoogroups.com
> > > Assunto: Re: [ib-support] Re: How to limit the nbr or rows
> > > returned by a Select statement
> > >
> > > With the Firebird. Is possible the select stament with limit...?
> > >
>
> =====
> Jose S. Romero
> Advanced Systems - Soluciones Informáticas
> Paraná - Entre Ríos - Argentina
>
> Ahora podés usar Yahoo! Messenger desde tu celular. Aprendé cómo hacerlo en Yahoo! Móvil: http://ar.mobile.yahoo.com/sms.html
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>