 WHERE EXISTS (
         SELECT 1 FROM concept_stage d WHERE r.concept_code_1 = d.concept_code AND r.vocabulary_id_1 = d.vocabulary_id
             AND d.concept_class_id in ('Branded Drug', 'Clinical Drug')
-    AND r.relationship_id = 'RxNorm has ing'
+    AND r.relationship_id = 'RxNorm has ing')
 ;
 
 

             AND r.lat = 'ENG';
COMMIT;

--18 Re-map Quantified Drugs and Packs
--Rename all relationship_id between anything and Concepts where vocabulary_id='RxNorm' and concept_class_id in ('Quant Clinical Drug', 'Quant Branded Drug', 'Clinical Pack', 'Branded Pack') and standard_concept is null from 'Maps to' to 'Original maps to'
UPDATE concept_relationship_stage
   SET relationship_id = 'Original maps to'
 WHERE ROWID IN (SELECT r.ROWID
                   FROM concept_relationship_stage r, concept_stage c
                  WHERE     r.vocabulary_id_2 = 'RxNorm'
                        AND c.concept_code = r.concept_code_2
                        AND c.vocabulary_id = r.vocabulary_id_2
                        AND c.concept_class_id IN ('Quant Clinical Drug',
                                                   'Quant Branded Drug',
                                                   'Clinical Pack',
                                                   'Branded Pack')
                        AND c.standard_concept IS NULL
                        AND r.relationship_id = 'Maps to');
COMMIT;		

--19 Add mapping from deprecated to fresh concepts
INSERT  /*+ APPEND */  INTO concept_relationship_stage (
  concept_code_1,
  concept_code_2,

 WHERE concept_code = 'N0000000001';
 COMMIT;

--20 Create all sorts of relationships to self, RxNorm and SNOMED
INSERT INTO concept_relationship_stage (concept_code_1,
                                        concept_code_2,
                                        relationship_id,
