SELECT ; crsPMPlan.IDNum, ; crsPMPlan.PlanID, ; crsPMPlan.ContID, ; crsPMPlan.UserID, ; crsPMPlan.Pin ; FROM crspmplan ; WHERE ; (crspmplan.IDNum == crspmplanh.IDNum) AND ; (ALLTRIM(crspmplan.USERID) == ALLTRIM(crspmplanh.USERID)) AND ; (ALLTRIM(crspmplan.Pin) == ALLTRIM(crspmplanh.Pin)) ; GROUP BY ; crsPMPlan.IDNum, ; crsPMPlan.PlanID, ; crsPMPlan.UserID, ; crsPMPlan.Pin ; INTO CURSOR tmpWork
SELECT ; crsPMPlan.IDNum, ; crsPMPlan.PlanID, ; crsPMPlan.ContID, ; crsPMPlan.UserID, ; crsPMPlan.Pin ; FROM crspmplan ; JOIN crsPMPlanH ON (crspmplan.IDNum == crspmplanh.IDNum) ; WHERE ; (ALLTRIM(crspmplan.USERID) == ALLTRIM(crspmplanh.USERID)) AND ; (ALLTRIM(crspmplan.Pin) == ALLTRIM(crspmplanh.Pin)) ; GROUP BY ; crsPMPlan.IDNum, ; crsPMPlan.PlanID, ; crsPMPlan.UserID, ; crsPMPlan.Pin ; INTO CURSOR tmpWork