有这样两张表
CJ表 字段为 workNo(文本) score(单精)
HZ表 字段为 workNo(文本) zf(单精)
现要求将cj表中相同工号(workNo)的分数(score)求和,将值传递给HZ表中workNo对应的总分(zf)
即:将select sum(score) from hz group by workNo
然后再update hz set zf=sum(score)
(以上写法只为表达意思!语法肯定不对)
求这样一UPDATE语句
谢谢了
------解决方案--------------------
即:将select sum(score) from hz group by workNo
然后再update hz set zf=sum(score)
update t set zf=(select sum(score) from cj where workNo=t.workNo) from hz t