Hi All

I am writing a query to match data accross four tables, quite simple I though until I relised that some data is not is all of the tables



This is what I have so far:-



Select distinct qh.query_no, qh.query_date, qh.site_no, qh.contact_name, qh.contact_phone_no,

(Select sd.building_name From T_Site_Details sd where qh.site_no = sd.site_no) as buildingname,

(Select sd.street_no From T_Site_Details sd where qh.site_no = sd.site_no) as Streetno,

(Select sd.street_1 From T_Site_Details sd where qh.site_no = sd.site_no) as Street1,

(Select sd.post_code From T_Site_Details sd where qh.site_no = sd.site_no) as postcode



From T_Query_Header qh

Where (qh.status = '0') and (qh.managed_by = 'My_Name') and (qh.query_type = '63')



This so far works but I am now trying to match data from another table that links into only the SD. table I tried to place the row below after the last select statment



(Select cd.Marketing From T_Customer_Details cd, T_Site_Details sd where cd.Customer_no = sd.Customer_no) as Marketing



But I fail to get any data,



These are my three tables:-

T_Query_Header qh

T_Site_Details sd

T_Customer_Details cd

They are linked as follows qh links to the sd by a field called "Site_No" and cd links in to sd via a field called Customer_no



I understand that if there is no data in the sd table that I won't get any data from the cd table but how do I write this so that I still get the data from the orig hq table.



Many Thanks for your help I have been banging m head all day over this one.





Mark :o)