Ver Mensaje Individual
  #5  
Antiguo 07-08-2008
Avatar de Casimiro Notevi
Casimiro Notevi Casimiro Notevi is offline
Moderador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.020
Reputación: 10
Casimiro Notevi Tiene un aura espectacularCasimiro Notevi Tiene un aura espectacular
Según Firebird 2.1 Release Notes:


Cita:
ROWS Syntax
D. Yemanov
ROWS syntax is used to limit the number of rows retrieved from a select expression. For an uppermost-level
select statement, it would specify the number of rows to be returned to the host program. A more understandable
alternative to the FIRST/SKIP clauses, the ROWS syntax accords with the latest SQL standard and brings some
extra benefits. It can be used in unions, any kind of subquery and in UPDATE or DELETE statements.
It is available in both DSQL and PSQL.
Syntax Pattern
SELECT ...
[ORDER BY <expr_list>]
ROWS <expr1> [TO <expr2>]
Examples
1.
SELECT * FROM T1
UNION ALL
SELECT * FROM T2
ORDER BY COL
ROWS 10 TO 100
2.
SELECT COL1, COL2,
( SELECT COL3 FROM T3 ORDER BY COL4 DESC ROWS 1 )
FROM T4
3.
DELETE FROM T5
ORDER BY COL5
ROWS 1
Points to Note
1. When <expr2> is omitted, then ROWS <expr1> is semantically equivalent to FIRST <expr1>. When both
<expr1> and <expr2> are used, then ROWS <expr1> TO <expr2> means the same as FIRST (<expr2>
- <expr1> + 1) SKIP (<expr1> - 1)
2. There is nothing that is semantically equivalent to a SKIP clause used without a FIRST clause.
Responder Con Cita