sqlserver的update语句
update e set score = score1 from PERF_DEPT_KPI e
left join (select score score1 ,SUPPER_WEIDU_ID from(
SELECT SUM (PDK.SCORE) score, pdk.grade, PD.SUPPER_WEIDU_ID
FROM PERF_DEPT_KPI PDK
LEFT JOIN PERF_DIMENSION PD ON PDK.WEIDU_ID = PD.WEIDU_ID
WHERE PD.IS_ADD = 1 AND PDK.GRADE = 2 AND PDK.PROJECT_ID =29
GROUP BY PD.SUPPER_WEIDU_ID, pdk.grade) a)b
on e.weidu_id = b.SUPPER_WEIDU_ID
where e.grade=1 and e.weidu_id in(select DISTINCT SUPPER_WEIDU_ID from PERF_DIMENSION c where c.is_add =1 and project_id =29)
oracle 的 update语句
update PERF_DEPT_KPI a
set SCORE = (select score from (
select sum(PDK.SCORE) score,pdk.grade,PD.SUPPER_WEIDU_ID
from PERF_DEPT_KPI PDK
LEFT JOIN PERF_DIMENSION PD on PDK.WEIDU_ID= PD.WEIDU_ID
where PD.IS_ADD=1 and PDK.PROJECT_ID=58095 and PDK.GRADE=2
group by PD.SUPPER_WEIDU_ID,pdk.grade ) b where a.WEIDU_ID= b.SUPPER_WEIDU_ID and a.grade=1 )
where a.grade=1 and a.weidu_id in(select DISTINCT SUPPER_WEIDU_ID from PERF_DIMENSION c where c.is_add =1 and project_id =58095)