请教group by的一个问题 select a , b ,c ,d from test where b > 100 group by d;这个语句为什么提示错误呢? 请帮帮忙 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select a , b ,c ,d from test where b > 100 group by a,b,c,d;或者select max(a) , max(b) ,max(c) ,d from test where b > 100 group by d; 自己去看错误提示; 聪明点多的也知道 如果存在d列相同数据 你的A,B,C的数据取哪个值?这不是让数据库为难吗? 1L和2L已经说了,3L也说了。。 SELECT后的字段中,如果该字段不在GROUP表达式后面,必须使用组(聚合)函数,如MIN,MAX,COUNT,SUM等 对于select中的列,如果使用了group by 子句,则这些列必须包含在group by 中,否则要以聚合函数的方式出现。你这个例子中,假定对c 求和,则使用sum(c),c列可以不用跟在group by 后后面,其他的都需要select a , b ,c ,d from test where b > 100 group by d; 改成select a , b ,sum(c) ,d from test where b > 100 group by a,b,d; select在存储过程中的使用 oracle数据快损坏,求解释~ imp导入命令 关于同学录系统的数据库设计 怎么样用一句SQL语句实现? 求ORACLE语法转换方法或工具 PL/SQL开发指导 declare 请问下提示第3行第7列select没有into 初学者求助:遇到导入时的报错该如何解决? 怎么过滤!组合sql语句的时候的一些词语 关于嵌套表与关系表 求一个查询语句
或者
select max(a) , max(b) ,max(c) ,d from test where b > 100 group by d;
聪明点多的也知道 如果存在d列相同数据 你的A,B,C的数据取哪个值?这不是让数据库为难吗?
你这个例子中,假定对c 求和,则使用sum(c),c列可以不用跟在group by 后后面,其他的都需要
select a , b ,c ,d from test where b > 100 group by d; 改成
select a , b ,sum(c) ,d from test where b > 100 group by a,b,d;