實例地址表SQL組行基於列的值
ID, EmployeeID, Address
1, 100, TownA
2, 200, TownA
3, 300, TownB
我怎麼能返回所有employess計數爲每一個獨特的地址?
e.g
EmployeeCount, Address
2 TownA
1, TownB
實例地址表SQL組行基於列的值
ID, EmployeeID, Address
1, 100, TownA
2, 200, TownA
3, 300, TownB
我怎麼能返回所有employess計數爲每一個獨特的地址?
e.g
EmployeeCount, Address
2 TownA
1, TownB
你應該這樣做沿着此線的東西。
SELECT count(EmployeeID) as EmployeeCount, Address FROM table GROUP BY Address
tblAddress組地址我問錯了問題,而不是EmployeeId的我有一列二進制文件,並希望總結而不是計數,但您的答案是正確的上面,謝謝 – user2202098
這是一個簡單的分組和count(列)
SELECT Count(*) EmployeeCount, Address
FROM yourTable
GROUP BY Address
使用組 –
'SELECT COUNT(ID)爲EMPLOYEECOUNT,由Address' – xQbert