 ;
 --20.2. Topography
 insert into concept_relationship_stage (concept_code_1,concept_code_2,vocabulary_id_1,vocabulary_id_2,relationship_id,valid_start_date,valid_end_date)
-select
+select distinct
 	c1.concept_code,
 	c1.site,
 	'ICDO3',
 	'ICDO3',
 	'Has Topography ICDO',
-	TO_DATE ('01.01.1970', 'dd.mm.yyyy'),
-	TO_DATE ('31.12.2099', 'dd.mm.yyyy')
+	TO_DATE ('19700101', 'yyyymmddd'),
+	TO_DATE ('20991231', 'yyyymmddd')
 from comb_table c1
 left join code_replace c2 on
 	c2.old_code = c1.concept_code

	'ICDO Condition',
	null,
	c.concept_code,
	TO_DATE ('01.01.1970', 'dd.mm.yyyy'),
	
	case when r.code is not null
		then (SELECT latest_update-1 FROM vocabulary WHERE vocabulary_id='ICDO3')
		else TO_DATE ('31.12.2099', 'dd.mm.yyyy')
		end,
		
	case when r.code is not null
		then 'D'

	'ICDO3',
	'SNOMED',
	'Maps to',
	TO_DATE ('19700101', 'yyyymmddd'),
	TO_DATE ('20991231', 'yyyymmddd')
from r_to_c_all
join monorelation on concept_code = code1
left join code_replace on
