UPDATE TABLEA A
SET (A.FIELDA,A.FIELDB) = (SELECT NVL(SUM(B.FIELDA),0),NVL(SUM(B.FIELDB),0)
FROM TABLEB B
WHERE B.FIELDC = @FIELDC
AND B.FIELDD = @FIELDD)
WHERE A.FIELDC = @FIELDC
AND A.FIELDD BETWEEN @FFIELDD AND @TFIELDD
AND EXISTS (SELECT C.FIELDD FROM TABLEB C
WHERE C.FIELDC = A.FIELDC
AND C.FIELDD = A.FIELDD);
위 오라클 구문을 MS-SQL 로 바꾸면 어떻게 하나여?
|