Subject Re: [firebird-support] update with subselect, speed / optimization (data repair)
Author Arno Brinkman
Hi SET and Philip,

> >update transactions set transactions.tax_entity_id = (select
> >bills.actual_tax_id from bills where
> >bills.id = transactions.bill_id) where transactions.tax_entity_id =
> >(select bills.provider_tax_id
> >from bills where bills.id = transactions.bill_id);
>
> I'll assume this SQL executes correctly. Try changing to
>
> update transactions
> set transactions.tax_entity_id =
> (select B1.actual_tax_id from bills B1
> where B1.id = transactions.bill_id)
> where EXISTS
> (select * from bills B2
> where transactions.tax_entity_id = B2.provider_tax_id
> AND B2.id = transactions.bill_id);

Using a EXISTS wouldn't help here. This is a problem for every IB and
FB1.0.x version. The only workaround is using a Stored Procedure or waiting
for FB1.5-final/using FB 1.5-RC4 (it's fixed in FB1.5).




Regards,
Arno Brinkman
ABVisie

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird links :
http://www.firebirdsql.com
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/


Nederlandse firebird nieuwsgroep :
news://80.126.130.81