我有一张名为 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
但是它不起作用。我该如何获取它?