Multi column update
From: Sashi <smalladi_at_gmail.com>
Date: Mon, 9 Nov 2009 12:03:43 -0800 (PST)
Message-ID: <ee61ae78-6824-456b-ae04-64f2241c9c15_at_n35g2000yqm.googlegroups.com>
Hi all, I'm trying to write where appears to be a simple query but can't get it right.
Date: Mon, 9 Nov 2009 12:03:43 -0800 (PST)
Message-ID: <ee61ae78-6824-456b-ae04-64f2241c9c15_at_n35g2000yqm.googlegroups.com>
Hi all, I'm trying to write where appears to be a simple query but can't get it right.
Here's the intent.
update A set (a1,a2,a3) = (select sum(b1),sum(b2),sum(b3) from B group
by b4 where B.b4 = A.A4)
I got two tables, A and B. The join parameters are A.A4 and B.B4. I need to updated a1, a2 and a3 in A to equal the sums of b1, b2 and b3 in B. The sum needs to be grouped by b4 and A.a4 needs to equal B.b4.
Can someone help?
TIA,
Sashi
Received on Mon Nov 09 2009 - 14:03:43 CST