Subject | Re: [firebird-support] Update on joined tables |
---|---|
Author | Ann W. Harrison |
Post date | 2005-07-13T18:41:35Z |
emel.hu wrote:
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
> update tableA aThe feature is not part of SQL99... I see it in a draft of 2003.
> 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 ;(
>
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