i don't understand that weird (+) syntax, so i hope you understand standard sql
Code:
select c.customerid
, c.customername
, a.address
from customers as c
left outer
join address as a
on c.customerid = a.customerid
and a.addresstype = 'postaddress'
in the above query, notice that the addresstype condition is in the ON clause
this means it is a condition of the join
let's imagine a customer without a postaddress
since this is a condition of the join, that customer will be returned with NULL in the address
by comparison, consider what happens when the addresstype condition is in the WHERE clause --
Code:
select c.customerid
, c.customername
, a.address
from customers as c
left outer
join address as a
on c.customerid = a.customerid
WHERE a.addresstype = 'postaddress'
now suppose there is a customer with no address at all
in a LEFT OUTER join, this customer is also returned with NULL in the address
but when the WHERE clause is evaluated, NULL is not equal to 'postaddress' so that customer is filtered out!
this in effect reverts the results of the join to the same as if you had specified an INNER join, and you get
only customers with a postaddress