> I'm not sure I understand your logic. Your left join > indicates that there are records missing from table2, > so I would expect that you want to insert the missing > records into table2. Assuming that's what you meant, > > insert into table2 > select * from table1 > where table1.field not in (select field from table2) > > or > > insert into table2 > select * from table1 > where not exists > (select field from table2 where table2.field=table1.field) > > The subquery in the first form is static (executed only > once). The subquery in the second form is correlated > (executed many times), but the second form can be > faster in some circumstances.
I missed out a bit of the logic. I want to be able to ask the user if they want to approve the addition of the new record, so I need to be able to do this as two separate operations, rather than combine them into a single sql statement. Rachel