I have a simple problem. I have two tables FROM and TO. I want to copy column Group from FROM to TO but only the rows which match the id_number. It should be very simple but I am stuck.
insert into TO (Group)
SELECT Group
FROM FROM
WHERE FROM.id_number like TO.id_number
OR
INSERT INTO TO (Group)
SELECT Group
FROM FROM
WHERE id_number IN (SELECT id_number FROM TO)
This one just adds additional columns to the table, it does not update the rows as per id_number….
Any idea?
You say “only the rows which match the id_number”. That implies
updatenotinsert.