|Subject||Re: [ib-support] Re: Not in query|
|Author||Svein Erling Tysvær|
>The problem is in that the secondary query is performed on eachFinally I get you. Luckily, I've never been in a situation like you
>iteration, and thus if 2 records have the same field value, the first record
>will be added, but the 2nd will not because when the secondary query is
>executed again, it will find that value in table2.
describe. If I had to, I guess I would have solved it by two stage process.
Add one integer field (NewField) to table2 and use something similar to
Helen's suggestion for step 1:
insert into table2 select *, 1 from table1 where (not (exists(select
commonkey from table2 where commonkey = table1.commonkey and NewField <> 1)))
set NewField = 0
This ought to get you two rows rather than one,