The following SQL script will create practice areas where they do not exist in the Matters table.
- --Synthesize missing practice areas from Matters
- INSERT INTO __M_Matters_PracticeAreas(
- Id,
- Final_Subject
- )
- SELECT DISTINCT
- Final_PracticeArea_Id,
- Final_PracticeArea_Id
- FROM
- __M_Matters
- WHERE 1=1
- AND Final_PracticeArea_Id != '' --Ignore Blank Practice Areas
- AND Final_PracticeArea_Id NOT IN (SELECT Id FROM __M_Matters_PracticeAreas)