var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: UPDATE using aggregate and inner join
I want the sum of an amount to update another table using inner join.
The following query -
SET A.[Col3] = SUM(B.[Col3])
INNER JOIN B
ON A.C1 = B.C1
AND A.C2 = B.C2
Gives me an error saying I cannot use SET with aggregate Column.
How do I perform this aggregate update?
one way is to use a subquery. try this:
update a set a.col3 = b.col3 from a inner join (select sum(col3) as col3 , c1, c2 from b group by c1, c2) b on a.c1 = b.c1 and a.c2 = b.c2