I am working on complicated problem, but I will simplify it to this problem.
I have two tables
A [ID, column1, column2, column3]
B [ID, column1, column2, column3, column4]
and I want to update the third:
C [ID, column1, column2,column3]
I am updating another third table using this query.
UPDATE C
set column1=t.firstTab, column2=t.secondTab, column3=t.thirdTab
from (select A.column1 as firstTab, B.column2 as secTab,
(A.column1 + B.column2) thirdTab
from A, B limit 1; ) as t ;
I got:
UPDATE 0
When I run this query:
select A.column1 as firstTab, B.column2 as secTab, (A.column1 + B.column2) thirdTab
from A, B limit 1;
I got results. Am I missing something ?
Sample data: http://sqlfiddle.com/#!15/e4d08/5