a表id lb
1 2
2 3
3 3
4 3
5 2
b表
id ls je
1 5
2 3
3 4
4 6
5 7 我想实现
if lb=3时批量更新b表对应a表相同id的je为ls的平方也就是当lb=3时
lb=3时
b表更新je为
id ls je
1 5
2 3 9
3 4 16
4 6 36
5 7
1 2
2 3
3 3
4 3
5 2
b表
id ls je
1 5
2 3
3 4
4 6
5 7 我想实现
if lb=3时批量更新b表对应a表相同id的je为ls的平方也就是当lb=3时
lb=3时
b表更新je为
id ls je
1 5
2 3 9
3 4 16
4 6 36
5 7
set
je=b.ls*b.ls
from
a,b
where
a.id=b.id and a.lb=3
set je = js * js
from b , a
where b.id = a.id and b.lb = 3
set je=b.ls*b.ls
from a,b
where a.id=b.id and a.lb=3你们手太快
update b
set je = cast(ls as int) * cast(ls as int)
from b , a
where b.id = a.id and b.lb = 3