示例表
| LastName | Firstname|
| | |
| Dela Cruz | Juan |
| Dela Cruz | John |
| Simon | Lucy |
| Stin | Joy |
| LastName | Firstname|
| | |
| Dela Cruz | Juan |
| Dela Cruz | John |
答案 0 :(得分:0)
SELECT m.`LastName` AS LName
, m.`FirstName` AS FName
, m.`MiddleName` AS MName
FROM table m JOIN ( SELECT `LastName`
FROM `table`
GROUP BY `LastName`
HAVING COUNT(*) > 1 ) x ON x.`LastName` = m.`LastName`