UPDATE 语句另一种用法
新学到一种更新表的方式,代码如下.
1 /* 更新表,把车队月调整写到表*/
2 UPDATE A
3 SET A.CDY_ADJUST = B.CDY_ADJUST
6
7 FROM OWNER_NAME_CASH A
8 INNER JOIN
9 (
10 SELECT
11 SUM(DCY_ADJUST) AS CDY_ADJUST
12 FROM OWNER_NAME_CASH
13 ) B
14 ON 1 =1
15
2 UPDATE A
3 SET A.CDY_ADJUST = B.CDY_ADJUST
6
7 FROM OWNER_NAME_CASH A
8 INNER JOIN
9 (
10 SELECT
11 SUM(DCY_ADJUST) AS CDY_ADJUST
12 FROM OWNER_NAME_CASH
13 ) B
14 ON 1 =1
15