Why can't you mix Aggregate values and Non-Aggregate values in a single SELECT?

后端 未结 6 1961
我寻月下人不归
我寻月下人不归 2020-11-29 07:04

I know that if you have one aggregate function in a SELECT statement, then all the other values in the statement must be either aggregate functions, or listed in a GROUP BY

6条回答
  •  独厮守ぢ
    2020-11-29 07:32

    The aggregate function and the group by clause aren't separate things, they're parts of the same thing that appear in different places in the query. If you wish to aggregate on a column, you must say what function to use for aggregation; if you wish to have an aggregation function, it has to be applied over some column.

提交回复
热议问题