[ https://issues.apache.org/jira/browse/TRAFODION-2066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15376810#comment-15376810 ]
liu ming commented on TRAFODION-2066: ------------------------------------- This feature is already supported, one need to turn on the CQD mode_special_4 to enable it. But more generic, some database support more flexible order by syntax, that the order by expression can be a random expression. This JIRA may change to support that kind of order by feature. > Not allowing Order By the aggregation, except when named > -------------------------------------------------------- > > Key: TRAFODION-2066 > URL: https://issues.apache.org/jira/browse/TRAFODION-2066 > Project: Apache Trafodion > Issue Type: Bug > Affects Versions: 2.1-incubating > Environment: EsgynDB Advanced Release 2.1.0 > JDBC Type 4, > Reporter: Yang Yang > Assignee: liu ming > Priority: Minor > Labels: newbie > > It's not allowed to Order By aggregates, unless a name is given to the > aggregate. For example, > Illegal to do "select id, groupid, sum(score) from t group by id, groupid > order by sum(score)". but it's legal to do "select id, groupid, sum(score) > as ttlscore from t group by id, groupid, order by ttlscore". > This may not be a problem with window functions. I've seen an example > Trafodion query: > "select username as userid,groupid,sum(allowed_size) as bandwidth, > row_number() over (partition by groupid order by SUM(allowed_size) desc) as > row_number from u_f-mv" . > This is not a blocking bug, but for those who'd like to test drive Trafodion, > the alternative of naming the aggregate may be put into SQL manual for now, > before the bug is fixed. -- This message was sent by Atlassian JIRA (v6.3.4#6332)