i have the following sql statement which I'd like to add another inner join to. I have a table called cts_enquiry_services which has two columns I'm interested in, EnquiryTypeID and ServiceID. ServiceID links back to the
ServiceID in cts_services, so i want to add an inner join for cts_enquiry_services ON serviceid=serviceid and also include a where statment for Where EnquiryTypeID (from cts_enquiry_services) = 17
thanks
kim
ServiceID in cts_services, so i want to add an inner join for cts_enquiry_services ON serviceid=serviceid and also include a where statment for Where EnquiryTypeID (from cts_enquiry_services) = 17
thanks
kim
Code:
SELECT ServiceID, DeptDesc, ServiceDesc as ServiceDesc,TargetDays,VOID,DEPARTMENT
FROM cts_services INNER JOIN cts_departments ON department=deptid WHERE minaccess <= 50 and serviceid IN (SELECT service FROM cts_service_locations WHERE location='ICT')
UNION
SELECT ServiceID, DeptDesc,ServiceDesc as ServiceDesc,TargetDays,VOID,DEPARTMENT FROM cts_services INNER JOIN cts_departments ON department=deptid WHERE minaccess <=50 and serviceid NOT IN (SELECT service FROM cts_service_locations WHERE location='ICT')