Mysql 基于列值的SQL组行

Mysql 基于列值的SQL组行,mysql,sql,Mysql,Sql,示例地址表 ID, EmployeeID, Address 1, 100, TownA 2, 200, TownA 3, 300, TownB 如何返回每个唯一地址的所有员工的计数 e、 g 你应该按照这个思路做点什么 SELECT count(EmployeeID) as EmployeeCount, Address FROM table GROUP BY Address 这是一个简单的分组 SELECT Count(*) EmployeeCount, Address FROM your

示例地址表

ID, EmployeeID, Address

1, 100, TownA
2, 200, TownA
3, 300, TownB
如何返回每个唯一地址的所有员工的计数

e、 g


你应该按照这个思路做点什么

SELECT count(EmployeeID) as EmployeeCount, Address FROM table GROUP BY Address

这是一个简单的分组

SELECT Count(*) EmployeeCount, Address
FROM yourTable
GROUP BY Address

使用group by and count(column)
选择count(ID)作为EmployeeCount,Address FROM tblAddress group by Address
我问了一个错误的问题,而不是EmployeeId的问题,我有一列二进制文件,想求和而不是计数,但你的答案是正确的,谢谢
SELECT Count(*) EmployeeCount, Address
FROM yourTable
GROUP BY Address