SQL的grop by 语法为,
select 选取分组中的列+聚合函数 from 表名称 group by 分组的列
从语法格式来看,是先有分组,再确定检索的列,检索的列只能在参加分组的列中选...所以问题中的,group by 后的 a,b,c是先确定的。select后的a,b,c才是可以变的。...即
以下语句都是正确的:
select a,b,c from table_name group by a,b,c,d;
select a,b from table_name group by a,b,c...;
select a,max(a) from table_name group by a,b,c;
以下语句则是错误的:
select a,b,c from table_name group by a,...但是在DOS是不能的。所以出现了DOS下报错,而在MySQL中能够查找的情况(其实这个查找的结果是不对的)。