Subject | Re: update from 2 tables |
---|---|
Author | Adam |
Post date | 2006-06-23T05:15:03Z |
--- In firebird-support@yahoogroups.com, "cbll_lam" <cbll_lam@...>
wrote:
In a normalised structure, it would be a very unusual query to have
to run. Normally you would never have a field of B duplicated into
table A, but rather define a foreign key and join when applicable.
If for some reason beyond my comprehension you needed to do it, the
easiest way to do it in Firebird is to use a stored procedure.
---
set term ^ ;
create procedure copythis
as
begin
for
select q, y
from b
into :q, :y
do
begin
update a set p = :q where x = :y;
end
end
^
set term ; ^
commit;
execute procedure copythis;
commit;
---
Adam
wrote:
>... hence the non standard syntax from Access.
> Thank you for pointing out my mistake. I must mixing it up with
> something else.
>
> It begs another question: how to do it in FB?
>
> Any suggestion will be appreciated.
>
> regards,
> bill
>
In a normalised structure, it would be a very unusual query to have
to run. Normally you would never have a field of B duplicated into
table A, but rather define a foreign key and join when applicable.
If for some reason beyond my comprehension you needed to do it, the
easiest way to do it in Firebird is to use a stored procedure.
---
set term ^ ;
create procedure copythis
as
begin
for
select q, y
from b
into :q, :y
do
begin
update a set p = :q where x = :y;
end
end
^
set term ; ^
commit;
execute procedure copythis;
commit;
---
Adam