Subject Re: update from 2 tables
Author Svein Erling Tysvær
--- In firebird-support@yahoogroups.com, bill_lam wrote:
>
> First of all, I must thank all who response and help me in this
> problem. I had rewritten using the query syntax, For multiple
> columns, I just using one query for each column.

If you update different records you have to do it this way (if you
dislike stored procedures), but if you always update different fields
on the same record, you can do something like:

update TableA a
set a.p=(select b.q from TableB b where b.y=a.x),
a.r=(select d.q from TableB d where d.y=a.x)
where exists(select * from TableB c where c.y=a.x)

(i.e. one query with multiple subqueries)

I don't have Firebird on this machine, and haven't checked the syntax.

Set