postgreSQL中的select from group by
postgreSQL中的如下代码:--错误
select name, description from subject group by name
--正确
select name from subject group by name
postgreSQL给出错误提示是:
錯誤:資料行 "subject.description" 必須出現在 GROUP BY 子句中,或用於彙總函式
LINE 1: select name, description from subject group by name
^
********** 错误 **********
錯誤: 資料行 "subject.description" 必須出現在 GROUP BY 子句中,或用於彙總函式
SQL 状态: 42803
也就是说select后面的列必须在group by列里面。
同样的表结构,对于MySQL而言,上面2种都是合法正确的。
个人理解:从功能及实现上理解,postgreSQL的这种限制显得没道理。
页:
[1]