Hello, I have 2 tables: Child_Table and Health_Table:Child_Table has columns: App_ID, MajorHealth_Table has columns used: Re_ID, PlanSample data: [i]Child Table[/i][code="sql"][u]App_ID[/u] [u]Major[/u]004540036 GEBOX004540036 GEBOX004540036 GEBOX004540036 GEBOX[/code]Sample data: [i]Health Table[/i] WITH COLUMNS[code="sql"][u]Re_ID[/u] [u]Major[/u]U1 GECCEU2 REDSGU5 GFRTYU7 GEBOXU8 JKIUTY[/code]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[code="sql"][u]App_ID[/u] [u]Re_ID[/u]004540036 U1004540036 U2004540036 U5004540036 U8[/code]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?
↧