I am struggling with this piece of SQL, and I was wondering if anyone could help me.
INSERT INTO table_1(
rec_1,
rec_2,
rec_3
)
VALUES (
val_1,
val_2,
val_3
)
Now rec_2 and rec_3 are clear and have absolute values. Rec_1 is populated with values ββfrom another table. Now I want to insert values ββfrom another table that do not yet exist in this table. I assumed that I should use WHERE NOT IN?
So, it will be something like this:
INSERT INTO table_1(
rec_1,
rec_2,
rec_3
)
VALUES (
val_1,
val_2,
val_3
)
WHERE NOT IN (
SELECT rec FROM table_2
)
But .. How can I insert these values ββin rec_1 in my query?
source
share