Subject Re: [firebird-support] Update on joined tables
Author Ann W. Harrison
emel.hu wrote:

> update tableA a
> set (a.field2, a.field2) =
> (select b.field2, b.field3 from TableB b
> where b.field1 = a.field1)
>
> It's standard SQL syntax and necessary for efficient work ;(
>

The feature is not part of SQL99... I see it in a draft of 2003.
There's a lot of SQL99 that we haven't done yet, let alone 2003.
I'm not sure I know what you mean by efficient work. Certainly a
statement like this looks ugly

update tablea
set field2 = select field2
from tableb b
where pk_field = b.pk_field,
set field3 = select field3
from tableb b
where pk_field = b.pk_field,
set field4 = select field4
from tableb b
where pk_field = b.pk_field,
set field5 = select field51
from tableb b
where pk_field = b.pk_field,
set field6 = select field6
from tableb b
where pk_field = b.pk_field,
.....
set field75 = select field5
from tableb b
where pk_field = b.pk_field;


but in practice, the whole path and expanded record for tableb are in
cache, so there's not great performance penalty.


Regards,


Ann