I want to know if a job does not have an ‘LI’ CompCode.
SELECT
bSLHD.Job, SLCT.SL, APVM.Vendor, APVM.Name, SLCT.CompCode, SLCT.ExpDate
FROM
bSLHD
INNER JOIN
SLCT ON bSLHD.SL = SLCT.SL
INNER JOIN
APVM ON bSLHD.Vendor = APVM.Vendor
Advertisement
Answer
It sounds like you want aggregation. Something like this:
SELECT bSLHD.Job
FROM bSLHD INNER JOIN
SLCT
ON bSLHD.SL = SLCT.SL INNER JOIN
APVM
ON bSLHD.Vendor = APVM.Vendor
GROUP BY bSLHD.Job
HAVING SUM(CASE WHEN SLCT.CompCode = 'LI' THEN 1 ELSE 0 END) = 0;
