I'd like to update table1 based upon a sum principally applied on table2 but including a single value from table 3.
table2 has a column that's FKd to table1's id column, and the sum is based upon them matching.
UPDATE table1, table2
SET table1.column1 =
(SELECT SUM( (SELECT constant FROM table3) +
(SELECT table2.sum_number
WHERE table2.table2_id1 = table1.id) ) )
WHERE table1.id = table2.table2_id1;
That doesn't work for me.
Many thanks in advance!
EDIT: Error Given
#1064 - You have an error in your SQL syntax; check the manual that corresponds
to your MySQL server version for the right syntax to use near
'WHERE table2.table2_id1 = table1.id) ) ) WHERE table1.id = table2.table2_id1;'