 join concept c on a.concept_code = c.concept_code and c.vocabulary_id = 'SNOMED' and a.concept_class_id like 'Branded Drug%'
  join concept_relationship r on r.concept_id_1 = c.concept_id 
  join concept d on r.concept_id_2 = d.concept_id and d.vocabulary_id = 'SNOMED'
-join drug_concept_stage cs on cs.concept_code  = d.concept_code and cs.concept_class_id like 'Clinical Drug%')
-;
---duplicates due to ONLY DEPRECATED to NON-DEPRECATED DRUGS relationship
+join drug_concept_stage cs on cs.concept_code  = d.concept_code and cs.concept_class_id like 'Clinical Drug%' 
+)
+;
+--duplicates due to ONLY DEPRECATED to NON-DEPRECATED DRUGS relationship??
 DELETE from Branded_to_clinical a 
 where exists (select 1 from 
 (

--"reboot" drug_concept_stage
--set concept_class_id = 'Supplier' where concept_class_id = 'Manufacturer', find this and set supplier in the beginning 
drop table drug_concept_stage; 
;
create table drug_concept_stage as select * from
drug_concept_stage_existing
 -- ok, what the hell? seems that this step gave most of mistakes, cause I use some misterious drug_concept_stage_existing -- check why I do so
;
select * from drug_concept_stage_existing
;
--work with manual table 
drop table ingred_to_ingred_FINAL_BY_Lena;

AND   CONCEPT_ID_2 = 19095976;

commit
;