我有一個表author_data
:發現有重複值的行一列
author_id | author_name
----------+----------------
9 | ernest jordan
14 | k moribe
15 | ernest jordan
25 | william h nailon
79 | howard jason
36 | k moribe
現在我需要的結果爲:
author_id | author_name
----------+----------------
9 | ernest jordan
15 | ernest jordan
14 | k moribe
36 | k moribe
也就是說,我需要的author_id
有重複的名字出場。我試過這個說法:
select author_id,count(author_name)
from author_data
group by author_name
having count(author_name)>1
但它不工作。我怎樣才能得到這個?