且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

错误:选择列表中的表达式无效(不包含在聚合函数或GROUP BY子句中)

更新时间:2022-11-25 21:00:43

The usage of GROUP BY makes the engine group the records for you. To do grouping, you have to give advice to the RDBMS for each column, what it should do.

  • Group it? -> Add column to GROUP BY-Clause
  • Not group it? -> ok, what else?
    • ignore the column? remove it from your select-clause
    • Sum it? -> use SUM(mycol)
    • other aggregation functions can be found in the documentation

Additionally: In your case you try to group by EPS_ID, which is unique in each row. So a grouping by that column will return all rows, because there is nothing to group by. To group records, they have to have the same value.

相关阅读

技术问答最新文章