ive5005s
asked on
select all records from table1 and Insert into table2 where not exists in table2
Hi,
I have two tables......... (please see below)
Both tables have a unique index on the "trec_code" and "matter_no" fields.
What I want to do is select all the records from "Table1" that do not exist in "Table2", and then insert those records into "Table2".
How do I achieve this???
Thanks,
Steve.
-------------------------- -----
Table1:
trec_code matter_no
--------- -----------
das 10000
das 20000
hpm 10000
hpm 20000
mjw 10000
mjw 20000
wdg 10000
wdg 20000
Table2:
trec_code matter_no
--------- -----------
das 20000
wdg 10000
-------------------------- -----
I have two tables......... (please see below)
Both tables have a unique index on the "trec_code" and "matter_no" fields.
What I want to do is select all the records from "Table1" that do not exist in "Table2", and then insert those records into "Table2".
How do I achieve this???
Thanks,
Steve.
--------------------------
Table1:
trec_code matter_no
--------- -----------
das 10000
das 20000
hpm 10000
hpm 20000
mjw 10000
mjw 20000
wdg 10000
wdg 20000
Table2:
trec_code matter_no
--------- -----------
das 20000
wdg 10000
--------------------------
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER