newbie question - how to list people who has not email address related to him/her? Sorry for my newbie question: I would like to list all people even those who has no email address in case of using many-to-many relation with superclass-sublclass inheritance.
Please see SQL Fiddle: http://sqlfiddle.com/#!17/8f556/8
Postgresql lists only the people who has email...
I tried this query:
select people.c_id as &quot;ID&quot;, 
    people.c_family_name as &quot;Family Name&quot;,
    people.c_last_name as &quot;Last Name&quot;,
    email.c_email as &quot;Email&quot;
from
    t_email email,
    t_people people
    left join t_ref_email ref_email on ref_email.c_party = people.c_id
where ref_email.c_party = people.c_id 
  and ref_email.c_email = email.c_id;

Result:
ID  Family Name Last Name   Email
1000    Test    Joe test_email@email.com

Test Bill was not listed because he has no email address...
Aliases should be short and meaningful
select pe.c_id as &quot;ID&quot;, 
    pe.c_family_name as &quot;Family Name&quot;,
    pe.c_last_name as &quot;Last Name&quot;,
    em.c_email as &quot;Email&quot;
    
from
t_people pe
LEFT JOIN t_ref_email re ON re.c_party = pe.c_id
LEFT JOIN t_email em ON em.c_id = re.c_email

With the result of
ID      Family Name     Last Name   Email
1000    Test            Joe         test_email@email.com
1001    Test             Bill        (null)