Hello, I have 2 tables: Child_Table and Health_Table:
Child_Table has columns used: App_ID, Major
Health_Table has columns used: Re_ID, Plan
Sample data:
Child Table
_App_ID_ _ Major_
004540036 GEBOX
004540036 GEBOX
004540036 GEBOX
004540036 GEBOX
Sample data:
_Health Table_
**Re_ID** **Major**
U1 GECCE
U2 REDSG
U5 GFRTY
U7 GEBOX
U8 JKIUTY
Sample Output Needs to be in Temp Table
** MUST SKIP Re_ID for this record but may be used for the next App_ID if Major does not match in both tables
App_ID Re_ID
004540036 U1
004540036 U2
004540036 U5
004540036 U8
I need to insert the App_ID and Re_ID into a temp table WHERE the Major and Plan can not be the same. Also each App_ID will be in the table 4 times and needs to have a different RE_ID assigned. Any ideas?