0

我在 mysql 代码中有一个错误,我正在尝试进行更新,但我得到了错误

错误 :

“错误 1111:无效使用组功能”

你能帮我知道我的代码有什么问题吗?我是 MySQL 的初学者

UPDATE
p_portfolio p LEFT JOIN p_portfolio_cstm pc
    ON p.id = pc.id_c
LEFT JOIN p_portfolio_p_purchaser_projects_1_c ppp1
    ON p.id = ppp1.p_portfolio_p_purchaser_projects_1p_portfolio_ida
LEFT JOIN p_purchaser_projects pp
    ON pp.id = ppp1.p_portfolio_p_purchaser_projects_1p_purchaser_projects_idb
LEFT JOIN p_purchaser_projects_cstm ppc
    ON pp.id = ppc.id_c

SET
pc.requested_itc_value_c = SUM(ppc.estimated_itc_value_c)

WHERE p.id = '4e9c9ea3-0880-4dc1-1063-5cbf71bd93bb'
AND p.deleted = 0 AND ppp1.deleted = 0 AND pp.deleted = 0;
4

1 回答 1

0
UPDATE
p_portfolio p INNER JOIN

(SELECT SUM(ppc.estimated_itc_value_c) as estimated_itc_value,pc.id_c,ppp1.deleted as ppp1_deleted,pp.deleted as pp_deleted 
FROM p_portfolio_cstm pc
LEFT JOIN p_portfolio_p_purchaser_projects_1_c ppp1
    ON p.id = ppp1.p_portfolio_p_purchaser_projects_1p_portfolio_ida
LEFT JOIN p_purchaser_projects pp
    ON pp.id = ppp1.p_portfolio_p_purchaser_projects_1p_purchaser_projects_idb
LEFT JOIN p_purchaser_projects_cstm ppc
    ON pp.id = ppc.id_c
) t2 ON p.id = t2.id_c
SET
pc.requested_itc_value_c = t2.estimated_itc_value

WHERE p.id = '4e9c9ea3-0880-4dc1-1063-5cbf71bd93bb'
AND p.deleted = 0 AND t2.ppp1_deleted = 0 AND t2.pp_deleted = 0;
于 2019-05-16T19:35:12.610 回答