1: 2: 3: 4: 5: 6: 7:
set cptrcid = cc.cptrcid from cpt c inner join cpt cc on c.cptcode = cc.cptcode inner join cptagency ca on c.id = cptid inner join cptagency caa on cc.id = cptid where ca.agencyid = 16 and caa.agencyid = 3