7
必须出现在GROUP BY子句中或在聚合函数中使用
我有一张桌子,看起来像这个呼叫者“ makerar” cname | wmname | avg --------+-------------+------------------------ canada | zoro | 2.0000000000000000 spain | luffy | 1.00000000000000000000 spain | usopp | 5.0000000000000000 我想为每个cname选择最大平均值。 SELECT cname, wmname, MAX(avg) FROM makerar GROUP BY cname; 但我会出错 ERROR: column "makerar.wmname" must appear in the GROUP BY clause or be used in an aggregate …