Glad to help :)You can add another condition to your where clause:WHERE policy_exp_date >= '20120101' AND policy_exp_date < '20120701' AND NOT EXISTS ( SELECT * FROM Table1 b WHERE a.policy_number = b.policy_number AND b.policy_exp_date >= '20120701' AND b.policy_cxl_date IS NULL )
If you want to include policies with effective cancel date later than today, you may want to modify that to:WHERE policy_exp_date >= '20120101' AND policy_exp_date < '20120701' AND NOT EXISTS ( SELECT * FROM Table1 b WHERE a.policy_number = b.policy_number AND b.policy_exp_date >= '20120701' AND ( b.policy_cxl_date IS NULL OR b.policy_cxl_date > GETDATE()) );