Hi Team,
I am trying to execute below query. I want all the columns in the table but
i get error if i include the columns not under group by. Can someone please
help me how to execute this query in phoenix?
select ELS_ID_CODE1, ELS_ID_CODE2, ELS_NAME, ELS_DESC, ELS_ACTIVE, max (
ELS_TIME_ID ) from ndm1.table1 WHERE ELS_ACTIVE = FALSE group by
ELS_ID_CODE1, ELS_ID_CODE2, ELS_ACTIVE;
This is the error i am getting
Error: ERROR 1018 (42Y27): Aggregate may not contain columns not in GROUP
BY. ELS_NAME (state=42Y27,code=1018)
java.sql.SQLException: ERROR 1018 (42Y27): *Aggregate may not contain
columns not in GROUP BY. ELS_NAME*
at
org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:361)
at
org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:133)
at
org.apache.phoenix.compile.ExpressionCompiler.throwNonAggExpressionInAggException(ExpressionCompiler.java:1141)
at
org.apache.phoenix.compile.ProjectionCompiler.compile(ProjectionCompiler.java:378)
at
org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:490)
at
org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:447)
at
org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:154)
at
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:331)
at
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:314)
at
org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:230)
at
org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:226)
at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
at
org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:225)
at
org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1066)
at sqlline.Commands.execute(Commands.java:822)
at sqlline.Commands.sql(Commands.java:732)
at sqlline.SqlLine.dispatch(SqlLine.java:808)
at sqlline.SqlLine.begin(SqlLine.java:681)
at sqlline.SqlLine.start(SqlLine.java:398)
at sqlline.SqlLine.main(SqlLine.java:292)
Thanks,
Durga Prasad