我如何計算mysql db表中任何字段的重複值。統計表字段中的重複值
例子:
id name
1 aaa
2 aaa
3 ttt
4 ccc
5 ttt
6 ccc
7 aaa
8 zzz
我怎樣才能獲得怎樣的值多次重複表等。
aaa =3 times in table
ttt =2 times in table
ccc =2 times in table
zzz =1 times in table
我認爲這可能與MySQL的計數,但如何使用它,我不知道任何一個可以幫助?請回答進階感謝馬的問題。
Isnt分組由id將產生相同的結果集,因爲它的獨特?他是否需要按名稱分組然後進行計數? :S –
絕對如此。謝謝。 –