If the subquery does not specify a table, it will match in its own table by default. If the condition field is not found, it will report that there is no such field. If it exists, it will perform a full table scan.

--正确
UPDATE WEB_PLY_BASE B
   SET B.N_AMT_VAR =
       (SELECT SUM(A.N_AMT_VAR)
          FROM WEB_PLY_CVRG A
         WHERE A.C_APP_NO = B.C_APP_NO)
 WHERE B.C_PLY_NO = '199320606022016000064';
--错误
UPDATE WEB_PLY_BASE
   SET N_AMT_VAR =
       (SELECT SUM(A.N_AMT_VAR)
          FROM WEB_PLY_CVRG A
         WHERE A.C_APP_NO = C_APP_NO)
 WHERE C_PLY_NO = '199320606022016000064';

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324979696&siteId=291194637