New to SQL I have two tables table_A
and table_B
.
I want to add data into a specific column of table_A
depending on a inner join
on table_B
. I am using Oracle, following this method my SQL looks like this :
I first tried that :
INSERT INTO table_A (target_column)
SELECT table_B.wanted_data
FROM table_B INNER JOIN table_A ON table_B.someColumnB = table_A.someColumnA
Here the issue is that it would insert the data in new lines of my table_A
and not in the existing lines.
So I tried that from the stackoverflow thread :
UPDATE(SELECT table_A.target_column, table_B.wanted_data
FROM table_A
INNER JOIN table_B
ON table_A.someColumnA = table_B.someColumnB
)
SET table_A.target_table = table_B.wanted_data
But it is not working either "SQL command not properly ended"
EDIT : target_column
and wanted_data
have the same name in my data set, not sure if it changes anything.