SQL更新多行数据为不同的值如何实现?

时间:2022-04-04 10:30:54

问题举例

表A

finterid fbillno frob
1 SOUT0001 1
2 SOUT0002 1
3 SOUT0003 -1
4 SOUT0004 -1

表B

finterid fsourceentryid fsourcebillno fnumber famount
1 01.001 15.00
1 01.002 20.00
2 01.003 30.00
2 01.004 50.00
3 SOUT0001 01.001 =(-1)*famount where finterid=1 and fnumeber=01.001
3 SOUT0001 01.002 =(-1)*famount where finterid=1 and fnumeber=01.001
4 SOUT0002 01.003 =(-1)*famount where finterid=2 and fnumeber=01.001
4 SOUT0002 01.004 =(-1)*famount where finterid=2 and fnumeber=01.001

问题提出

如何用一条语句更新finterid in(3,4)的famount的值。

问题解答

????????????????????????