I have two tables,CR_RefMaster andSELECT DISTINCT CR_RefMaster.Name, CR_RefMaster.RefCode,CR_RefAddresses. I am trying to join information from both (using the RefCode column) and return a blank or Null value for theCR_Refwhere the RefCode does not exist inAddresses columnsCR_Ref.Addresses
I have created the following query, but LEFT JOIN does not seem to be working. Wherethe RefCode does not exist in CR_RefAddresses, what is happening is that the entire row for that RefCode goes missing:
CR_RefAddresses.Country,CR_RefAddresses.AddrType
FROM CR_RefMaster LEFT JOIN CR_RefAddresses ON CR_RefMaster.RefCode=CR_RefAddresses.RefCode
WHERECR_RefAddresses.AddrType In ('RO','RA') ANDCR_RefAddresses.CardActive<>0
ANDCR_RefMaster.Status='0' AND CR_RefMaster.CS=0 AND CR_RefMaster.RefType<>'O'
ORDER BYCR_RefMaster.Name
I hope someone can help.
Kind regards.
Taryn