Table 1
Name Class
-------- -------
John A
Peter B -- data comes in second day.
Table 2
Name Class Flag
-------- ------- -------
John A Y
I have two tables. Everyday, new records will be inserted into Table 1. At the begninning of the week, i will select data from Table 2(based on some rules) and process them Those that are processed are marked Y under flag. So each time i'll just
select * from table 2 where flag1 is null and <more conditions>
to run my process. My problem is how can i only select data from table 1 and are not in table 2 and copy them into Table 2. I cannot truncate Table 2 and copy from Table 1 each time, because i cannot process the same data again. i.e how can i only copy Peter from Table 1 without affecting John in Table 2.
I thought of this
insert into Table 2
select * from Table 1 where Table1.Name not in Table2;
I believe this is wrong, any advise?
Message was edited by:
learningoracle