当前位置:Gxlcms > 数据库问题 > SQL------聚集函数

SQL------聚集函数

时间:2021-07-01 10:21:17 帮助过:2人阅读

。例如:

Drop TABLE if exists t1;

drop table if exists t2;

create table t2(a int, b int, c int);

insert into t2 values(1,2,3);

insert into t2 values(2,2,2);

insert into t2 values(2,2,2);

insert into t2 values(3,2,2);

commit;

select b, c case when c > (select avg(t.b) from t2 ) then 1 else 0 end as d from t2 t group by c, b order by 1;   --该语句正常执行结果是要报错的。报错是正常的,不报错则有问题。

drop table if exists t2;

 

SQL------聚集函数

标签:exist   sql语句   creat   sel   语句   select   cas   color   bsp   

人气教程排行