我有一个使用 Hibernate 的应用程序。它生成了以下 SQL 语句。我正在尝试修改查询以对数据进行分组,但我不断收到错误消息
ORA-00979: not a GROUP BY expression
查询
> select
> snstoken0_.id as id20_0_,
> snstokenme1_.SNS_MESSAGE_ID as SNS2_21_1_,
> snstokenme1_.SNS_TOKEN_ID as SNS3_21_1_,
> snsmessage2_.id as id19_2_,
> snsmaster3_.id as id17_3_,
> snstokenpr4_.id as id22_4_,
> snstoken0_.ACTIVE_STATE as ACTIVE2_20_0_,
> snstoken0_.MEMBER_ID as MEMBER8_20_0_,
> snstoken0_.SNS_MASTER_ID as SNS9_20_0_,
> snstoken0_.TOKEN1 as TOKEN3_20_0_,
> snstoken0_.TOKEN2 as TOKEN4_20_0_,
> snstoken0_.TOKEN3 as TOKEN5_20_0_,
> snstoken0_.DATE_TOKEN as DATE6_20_0_,
> snstoken0_.USERNAME as USERNAME20_0_,
> snstokenme1_.ARTICLE_ID as ARTICLE1_21_1_,
> snstokenme1_.SNS_TOKEN_ID as SNS3_20_0__,
> snstokenme1_.SNS_MESSAGE_ID as SNS2_0__,
> snstokenme1_.SNS_TOKEN_ID as SNS3_0__,
> snsmessage2_.ACTIVE_STATE as ACTIVE2_19_2_,
> snsmessage2_.CONTENT_ID as CONTENT5_19_2_,
> snsmessage2_.MESSAGE_TEXT as MESSAGE3_19_2_,
> snsmessage2_.SNS_MESSAGE_ID as SNS6_19_2_,
> snsmessage2_.POST_DATE as POST4_19_2_,
> snsmaster3_.ACTIVE_STATE as ACTIVE2_17_3_,
> snsmaster3_.ACTIVE_ICON as ACTIVE3_17_3_,
> snsmaster3_.AUTHENTICATION_URL as AUTHENTI4_17_3_,
> snsmaster3_.BREAK_TOKEN_URL as BREAK5_17_3_,
> snsmaster3_.INACTIVE_ICON as INACTIVE6_17_3_,
> snsmaster3_.NAME as NAME17_3_,
> snsmaster3_.URL_WEBSITE as URL8_17_3_,
> snstokenpr4_.ACTIVE_STATE as ACTIVE2_22_4_,
> snstokenpr4_.SNS_TOKEN_ID as SNS5_22_4_,
> snstokenpr4_.VALUE as VALUE22_4_,
> snstokenpr4_.VAR as VAR22_4_,
> snstokenpr4_.SNS_TOKEN_ID as SNS5_20_1__,
> snstokenpr4_.id as id1__
> from
> SNS_TOKEN snstoken0_
> left outer join
> SNS_TOKEN_MESSAGE snstokenme1_
> on snstoken0_.id=snstokenme1_.SNS_TOKEN_ID
> left outer join
> SNS_MESSAGE snsmessage2_
> on snstokenme1_.SNS_MESSAGE_ID=snsmessage2_.id
> left outer join
> SNS_MASTER snsmaster3_
> on snstoken0_.SNS_MASTER_ID=snsmaster3_.id
> left outer join
> SNS_TOKEN_PROP snstokenpr4_
> on snstoken0_.id=snstokenpr4_.SNS_TOKEN_ID
> group by
> snstoken0_.MEMBER_ID
> having
> snstokenpr4_.VAR='PROFILE_IMAGE'