Subject | Re: [ib-support] Re: Not in query |
---|---|
Author | Svein Erling Tysvær |
Post date | 2001-07-03T10:47:29Z |
>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:
Step 1:
insert into table2 select *, 1 from table1 where (not (exists(select
commonkey from table2 where commonkey = table1.commonkey and NewField <> 1)))
Step 2:
update table2
set NewField = 0
This ought to get you two rows rather than one,
Set