表a lqe01 lqe02
10001
10002
10003
10004
10005
.
.
.
10010表b lpz03 lpz04 lpz05
10001 10002 100
10003 10005 800
10006 10010 300我要怎么根据表B的lpz05来更新表A的lqe02字段,结果如下:
表a lqe01 lqe02
10001 100
10002 100
10003 800
10004 800
10005 800
10006 300
10007 300
10008 300
10009 300
10010 300
10001
10002
10003
10004
10005
.
.
.
10010表b lpz03 lpz04 lpz05
10001 10002 100
10003 10005 800
10006 10010 300我要怎么根据表B的lpz05来更新表A的lqe02字段,结果如下:
表a lqe01 lqe02
10001 100
10002 100
10003 800
10004 800
10005 800
10006 300
10007 300
10008 300
10009 300
10010 300
set lqe02 = B.lpz05
from B where a.lqe01 =B.lqe03
set lqe02 = B.lpz05
from B where a.lqe01 =B.lqe03 OR a.lqe01 =B.lqe04
set lqe02 = B.lpz05
from B where a.lqe01>=B.lqe03 OR a.lqe01<=B.lqe04
set lqe02 =(select lpz05 from B where B.id=A.id)
where exists (select 1 from B where B.id= A.id)