我有一个表人员
Name | Surname | City | Street | Some Common Field|
A1 | B1 | C1 | S1 | 1 |
A2 | B2 | C1 | S1 | 1 |
A3 | B3 | C2 | S2 | 2 |
A4 | B4 | C2 | S2 | 2 |
A5 | B5 | C3 | S3 | 3 |
我需要结果
Count |City | Street | Some Field|
2 | C1 | S1 | 1 |
2 | C2 | S2 | 2 |
1 | C3 | S3 | 3 |
我怎样才能得到它?
答案 0 :(得分:4)
SELECT COUNT(*) AS Cnt,
City,
Street,
SomeField
FROM YourTable
GROUP BY City,
Street,
SomeField