Subject | Re: update from 2 tables |
---|---|
Author | Svein Erling Tysvær |
Post date | 2006-06-24T14:39:41Z |
--- In firebird-support@yahoogroups.com, bill_lam wrote:
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
>If you update different records you have to do it this way (if you
> 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.
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