MySQL中group by函数需要注意一点,如 A,B两字段
A B
1 a
1 b
1 c
如果直接写SQL:select A,B from tableName group by A;并不会得到想要的结果
A B
1 a+b+c
SQL需要这样写:select A,count(B) from tableName group by A
MySQL中group by函数需要注意一点,如 A,B两字段
A B
1 a
1 b
1 c
如果直接写SQL:select A,B from tableName group by A;并不会得到想要的结果
A B
1 a+b+c
SQL需要这样写:select A,count(B) from tableName group by A