Going by your example, if you want the name “John” to be referenced the same in multiple records, you may have a separate ‘name’ table. You would then reference the name “John” from that table by its ID as a foreign key.
Though we probably need to see more of your database and its intenden purpose to give a solid answer.
SELECT t1.id, t1.fathername, t1.sonname, t2.sonname AS s2name
FROM tablename AS t1
LEFT JOIN tablename AS t2 ON (
t1.fathername = t2.fathername
AND t2.id > t1.id
)
WHERE t2.sonname IS NOT NULL
UNION
SELECT id, fathername, sonname, "" AS s2name
FROM tablename
WHERE fathername IN(
SELECT fathername FROM(
SELECT fathername, COUNT(fathername) as c1
FROM tablename
GROUP BY fathername HAVING c1 = 1
) as t3
)
Could it be done better? possibly. Is my brain at 8 AM on a Sunday put effort into making a bad idea work better?..