Y
YYZ
I could have sworn I've done this in the past, but I can't get the syntax
right for the life of me. If anyone can spot what I'm doing wrong, or tell
me that you just can't do this, please feel free.
I have 2 tables. WC and WCM. WC is a Wall code. A wall code can have 0 or
more Materials(WCM). They are joined on a common field in both tables,
wall_code_id.
I need to set WC.report_extended_total = Sum(WCM.bid_proportion)
Here's what I've tried:
UPDATE WC INNER JOIN WCM ON
WC.wall_code_id = WCM.wall_code_id
SET WC.report_extended_total = Sum(WCM.bid_proportion)
This results in an error: "You tried to execute a query that does not
include the specified expression 'report_extentded_total' as part of an
aggregate function.
So then I tried:
UPDATE WC
SET WC.report_extended_total =
(SELECT Sum(WCM.bid_proportion)
FROM WCM
WHERE WCM.wall_code_id = WC.wall_code_id)
FROM WC
I tried it with and without the "FROM" line. Errors with "missing operator
in query expression...." and "operation must use an updatable query"
Any ideas on what I'm doing wrong?
Matt
right for the life of me. If anyone can spot what I'm doing wrong, or tell
me that you just can't do this, please feel free.
I have 2 tables. WC and WCM. WC is a Wall code. A wall code can have 0 or
more Materials(WCM). They are joined on a common field in both tables,
wall_code_id.
I need to set WC.report_extended_total = Sum(WCM.bid_proportion)
Here's what I've tried:
UPDATE WC INNER JOIN WCM ON
WC.wall_code_id = WCM.wall_code_id
SET WC.report_extended_total = Sum(WCM.bid_proportion)
This results in an error: "You tried to execute a query that does not
include the specified expression 'report_extentded_total' as part of an
aggregate function.
So then I tried:
UPDATE WC
SET WC.report_extended_total =
(SELECT Sum(WCM.bid_proportion)
FROM WCM
WHERE WCM.wall_code_id = WC.wall_code_id)
FROM WC
I tried it with and without the "FROM" line. Errors with "missing operator
in query expression...." and "operation must use an updatable query"
Any ideas on what I'm doing wrong?
Matt