[ https://issues.apache.org/jira/browse/DERBY-6008?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Dag H. Wanvik updated DERBY-6008: --------------------------------- Attachment: derby-6008-a.stat derby-6008-a.diff Uploading a patch that makes this construction work, running regressions. > Allow ORDER BY and FETCH/OFFSET in set operands > ----------------------------------------------- > > Key: DERBY-6008 > URL: https://issues.apache.org/jira/browse/DERBY-6008 > Project: Derby > Issue Type: Improvement > Components: SQL > Reporter: Dag H. Wanvik > Attachments: derby-6008-a.diff, derby-6008-a.stat > > > Currently, Derby doesn't allow ORDER BY nested in a set operand, e.g. in the following construct: > (select i from t1 order by j offset 1 row) union > (select i from t2 order by j desc offset 2 rows) > This is allowed by the standard, as far as I can understand, cf. this quote from section 7.12 in SQL 2011: > ::= > > | UNION [ ALL | DISTINCT ] > [ ] > | EXCEPT [ ALL | DISTINCT ] > [ ] > ::= > > | INTERSECT [ ALL | DISTINCT ] > [ ] > ::= > > | > [ ] [ ] [ ] > I.e. the left paren chooses the second alternative in the production for . -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira