|Subject||RE: [firebird-support] Re: update from 2 tables|
> --- In email@example.com, "cbll_lam" <cbll_lam@...>what about
> > 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
update a set a.p=(select b.q from b where b.y=a.x);
> ... hence the non standard syntax from Access.
> 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
> select q, y
> from b
> into :q, :y
> update a set p = :q where x = :y;
> set term ; ^
> execute procedure copythis;