I faced a situation where I got duplicate values from LEFT JOIN. I think this might be a desired behavior but unlike from what I want.
I have three tabl
I think you just need to get lists of departments and phones for particular person. So just use array_agg (or string_agg or json_agg):
SELECT
p.id,
p.person_name,
array_agg(d.department_name) as "department_names",
array_agg(c.phone_number) as "phone_numbers"
FROM person AS p
LEFT JOIN department AS d ON p.id = d.person_id
LEFT JOIN contact AS c on p.id = c.person_id
GROUP BY p.id, p.person_name