legacy-knowledge-base
公開されました Jul. 2, 2025

java.sql.SQLSyntaxErrorException: GROUP BY を使用しない集計クエリでは、SELECT リストの式 #1 に集計されていない列 'lportal.this_.searchText' が含まれています。これは sql_mode=only_full_group_by と互換性がありません

written-by

Jorge García Jiménez

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

問題

  • group by 句を使用する動的クエリがあります。 以下で実行すると、ログにエラーが表示されます。
    error: Caused by: java.sql.SQLSyntaxErrorException:In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'lportal.this_.searchText'; this is incompatible with sql_mode=only_full_group_by

Environment

  • Liferay DXP 7.2、Liferay Experience Cloud - セルフマネージド

解決策

  • データベース サービスの sql_mode を変更します。 環境変数またはデータベース サービスの lcp.json ファイル内で変更できます。
  • 環境変数の名前:
    LCP_GCP_DATABASE_FLAG_SQL_MODE
  • 値:
    STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

追加情報

did-this-article-resolve-your-issue

legacy-knowledge-base