举个例子
我想通常遇到的情况是这样的语句
select a,b,count(*) from table group by a ,b
是对的语句
select a,b,count(*) from table group by a
是错误的因为group by 字句没有对b 进行分组,而且b字段上没有用分组函数,即没有在
group by 字句中出现的字段必须使用分组函数,否则就必须在group by 子句中出现
我想通常遇到的情况是这样的语句
select a,b,count(*) from table group by a ,b
是对的语句
select a,b,count(*) from table group by a
是错误的因为group by 字句没有对b 进行分组,而且b字段上没有用分组函数,即没有在
group by 字句中出现的字段必须使用分组函数,否则就必须在group by 子句中出现
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货