update purchase_box set total_value= sum(B.quantity*B.unit_price) from purchase_box A,purchase_sub_and_box B where A.id=B.box_id执行结果如下:
聚合不应出现在 UPDATE 语句的集合列表中请问怎么解决?
聚合不应出现在 UPDATE 语句的集合列表中请问怎么解决?
purchase_sub_and_box where box_id=A.id)
from purchase_box A
purchase_sub_and_box where box_id=A.id)
from purchase_box A
update A set total_value= (select sum(quantity*unit_price*B.form_money_rate) from purchase_sub_and_box ) from purchase_box A,purchase_form B,
purchase_sub_and_box C,purchase_sub_form D where D.purchase_form_id=B.id
and D.purchase_sub_no=C.order_no and C.box_id=A.id执行出错信息如下:
在包含外部引用的被聚合表达式中指定了多个列。如果被聚合的表达式包含外部引用,那么该外部引用就必须是该表达式中所引用的唯一的一列。问题就在于B.form_money_rate这个汇率,如果去掉就能正常执行,但是这个必须的啊,请问这个问题如何处理啊?
purchase_sub_and_box C,purchase_sub_form D where D.purchase_form_id=B.id
and D.purchase_sub_no=C.order_no and C.box_id=A.id