Hi,
I have a problem with an insert, basically I've populated a table (say table_a) with records based on one criteria, and have to then insert records into table_a based on another criteria, but only if they don't already exist in table_a. E.g.
insert into table_a (account_no, reference_no, status)
select
account_no = a.account_no
reference_no = a.reference_no
status = 'A'
from table_x a
where
etc
Then I need to insert more records, based on slightly different criteria (which will have status = 'B') but only if there isn't already a record in table_a with the same account_no / reference_no combination.
Can anybody suggest a way of doing that?
Cheers
I have a problem with an insert, basically I've populated a table (say table_a) with records based on one criteria, and have to then insert records into table_a based on another criteria, but only if they don't already exist in table_a. E.g.
insert into table_a (account_no, reference_no, status)
select
account_no = a.account_no
reference_no = a.reference_no
status = 'A'
from table_x a
where
etc
Then I need to insert more records, based on slightly different criteria (which will have status = 'B') but only if there isn't already a record in table_a with the same account_no / reference_no combination.
Can anybody suggest a way of doing that?
Cheers