Subject RE: [firebird-support] Re: Multiple table update question
Author Daniel Jimenez
[snip]
>
> I may not be reading the original query correctly, but (after some
> reformatting) I think it looks like this:
> ----------------
> update table1 T1
> set T1.field2 = (select T2.field2
> from table2 T2
> where T2.field1 = T1.field1
> )
> where exists (select *
> from table2 T3
> where T3.field1 = T2.field1
> )
> ----------------
> and there's no "where T2.field1 = T2.field1" to be seen.
>
> Still, I think the "where T3.field1 = T2.field1" makes no
> sense: at this point, what is T2?
> Unless I'm the one missing the point - not unlikely at all.
>
>
> --
> Aage J.
>

Hi Aage,

This is to funny for words, neither of us have a clue anymore. However, do
not worry, I decided last week to write a execute proc to deal with the
update.

If you are still interested in the question, it read on. I have copy the
original sql you email back.
UPDATE table1 T1
SET T1.field2 = (select T2.field2 FROM table2 T2
where T2.field1 = T1.field1) where exists(select * from
table2 T3
where T3.field1 = T2.field1) **** this is the line which
confuses me, as you appear to compare fields in the same table.


As I said above, do not worry, the problem is fix, but thank you for your
help, I appreciate it.

daniel