Here are two tables {PERSONS, CONTACTS}
I want the following result form these two tables
PersonID | Name
1 | A
2 | B
3 | C
4 | D
5 | E
Table Contacts:
ContactID | PersonID | Type | Contact
1 | 1 | p | 051-001
2 | 1 | e | A@
3 | 2 | p | 051-002
4 | 2 | e | B@
5 | 3 | p | 051-003
6 | 4 | p | 051-004
7 | 4 | e | D@
Desired result output:
Name | Contact
A | 051-001
B | 051-002
C | 051-003
D | 051-004
E | NULL
Please look at the Fiddle for this problem
SQLfiddle for Problem
Nor sure why you dont want a left join but this is using a sub query.