Insert Into B(column1)
Select A.Column1
From A
Where A.Column1 not in (Select Column1 From B)
complete a table with data from an other one
Domanda
I have two tables A(column1,column2)
and B(column1,column2)
.
How to ensure that a value from A(column1) is not contained within B(column1) and insert it in this column.
My Query will be like this :
insert into B.column1 values()
where
...
I want to complete B.column1 with data from A.column1
What should i put in the where
clause ?
Soluzione
Altri suggerimenti
I would use MINUS command and select all rows from A(column1) which are not in B(column1) and then SELECT INTO result into B table.
insert into B
select a.column1, a.column2 from a
left join b
on a.column1 = b.column1
where b.column1 is null
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow