Skip to content

SQL: GroupBy with ordinal returns an error #36059

@matriv

Description

@matriv
SELECT gender AS g,
  SUM({fn CONVERT(emp_no, SQL_BIGINT)}) AS "sum"
FROM test_emp
GROUP BY 1
HAVING (NOT (SUM({fn CONVERT(emp_no, SQL_BIGINT)}) IS NULL));

throws:

java.sql.SQLDataException: line 4:10: Group ordinal 1 refers to an aggregate function Alias which is not compatible/allowed with GROUP BY

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions