>select k_prempl, k_prdedmst > from c_PenDetail pd > WHERE NOT EXISTS ( SELECT * FROM prdedemp > WHERE k_prdedmst = pd.k_prdedmst AND k_prempl = pd.k_prempl) > >* or >select pd.k_prempl, pd.k_prdedmst > from c_PenDetail pd > LEFT JOIN prdedemp pr ON pr.k_prdedmst = pd.k_prdedmst AND pr.k_prempl = pd.k_prempl > WHERE pr.k_prdedmst IS NULL > >>>here is the revised code that does work as I want. I have a cross reference table that matches employees with deductions using keys K_PREMPL and K_PRDEDEMP. I need to add new records where K_PREMPL+K_PRDEDEMP exist in the cursor c_PenDetail but do not exist in prdedemp.
* Add any missing deduction types for each employee. >>TEXT TO mSqlCommand noshow pretext 15 TEXTMERGE >> insert into <<xfprdedemp>> >> (k_prempl, k_prdedmst) >> >> select k_prempl, k_prdedmst >> from c_PenDetail >> >> where transform(k_prdedmst,'9999999999')+ transform(k_prempl,'9999999999') >> not in (select transform(k_prdedmst,'9999999999')+ transform(k_prempl,'9999999999') from prdedemp) >>ENDTEXT >>&mSqlCommand>>