Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

创建视图时报 SELECT list is not in GROUP BY clause and contains nonaggregated column #632

Open
ZhuhongLee opened this issue Jan 16, 2024 · 0 comments

Comments

@ZhuhongLee
Copy link

描述
创建视图
create or replace view test_dba as SELECT name,round(sum(score),2) as score from test group by name ;
检测时报错
Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'ROUND(SUM(score), 2)' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by.

重现
create table test (id int auto_increment PRIMARY key ,name VARCHAR(10) , score DECIMAL(5,3)) ;

insert into test(name,score) values('张三',66.789);
insert into test(name,score) values('张三',77.789);
insert into test(name,score) values('张三',88.789);
insert into test(name,score) values('李四',99.789);
insert into test(name,score) values('李四',90.789);

create or replace view test_dba as SELECT name,round(sum(score),2) as score from test group by name ;
点击检测时报错

环境

  • 数据库: [阿里云 RDS MySQL]
  • 版本: [例如 8.0.28]

参数
inception 的sql_mode ="" ,跟随目标实例

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant