11智能在线
新记
聚合函数关于group by后面字段要不要在select后面出现
如题所述
举报该文章
相关建议 2015-02-08
group by后面的字段都要在select后面出现,以下例子仅供参考:
正确的写法:
select col1,col2,sum(col3),avg(col4) from table_name group by col1,col2;
如果你这样写肯定报错:
select col1,col2,sum(col3),avg(col4) from table_name group by col1;
温馨提示:内容为网友见解,仅供参考
当前网址:
https://11.t2y.org/zz/4s28mp772qqs2qfp2p.html
其他看法
无其他回答
相似回答
大家正在搜
相关问题
如果在select子句中有不在列函数中的列,则该列一定要出现...
SQL中查询多个字段时,GROUP BY 要怎么使用?
在含有Group by子句的查询语句中,对select关键...
group by 后面可以带两个字段吗
在 select 语句中什么情况采用group by
在聚合函数里的字段 不在group by 还是提示列无效
在使用带有group by子句的查询命令时,select后的...