I’m trying to join a table that may or may not have a relevant post and want to see even those ones where there isn’t. Short example:
Select * from customer cu
join customerphone cp on cu.customer_id = cp.customer_id
This far no problems because I only want customers who have a phone number registered but how do I join an another table where not all the customers have a row and I want in end result also those without a row to be shown. Is this even possible to do or should I then afterwards just check whether there is relevant data or not?
You use a left (outer) join. Example:
The data that you get where there is no matching record will be null, i.e. where there is no complaint, cc.Complaint will return null.