I\'d like to update the columns in on table based on the values of another table, I use a slightly old version of Firebird 2.1 so it doesn\'t have support for the join statement
Update your query as follow
update elements E set E.END_I = (select first 1 n.node_num from nodes N
where (N.XI =E.X_I and N.YI = E.Y_I and N.ZI=E.Z_I) )
where exists (select 1 from nodes N where (N.XI =E.X_I and N.YI = E.Y_I and N.ZI=E.Z_I))
You should add first 1
because of firebird 2.1 doestn`t know that subquery return only one row.
Instead of trying to use UPDATE
, use MERGE:
merge into elements E
using node N
on N.XI = E.X_I and N.YI = E.Y_I and N.ZI = E.Z_I
when matched then
update set E.END_I = N.node_num
Merge allows you to use another table, view or query as source of the data to update or insert into a table.