我在成功运行查询时遇到问题
select session from (select F_SESSION as session
FROM T_TEMP GROUP BY F_SESSION ) a ;
以上运行成功。但是,下面的一个失败
select session, count(total) from (select F_SESSION as session,
case when F_RECORDED_VALUE != 0 then F_RECORDED_VALUE end as total FROM T_TEMP GROUP BY F_SESSION ) a ;
错误是
FAILED: SemanticException [Error 10025]: Line 4:30 Expression not in GROUP BY key '0'
有人能指出我出错的地方吗?
答案 0 :(得分:1)
select session, count(total) from (select F_SESSION as session,
case when F_RECORDED_VALUE != 0 then F_RECORDED_VALUE end as total FROM T_TEMP ) a
group by session;