fname | lname ---------+------- Bill | Clinton Bill | Gates George | Bush George | Clinton Barack | Obama
我想编写一个查询,返回表中每个人的姓氏和姓氏,其名称在“lname”列中至少出现两次。如何编写这个SQL查询?
SELECT fname,lname FROM Celebrities WHERE lname IN (SELECT lname FROM Celebrities GROUP BY lname HAVING COUNT (lname) >1)