------解决方案-------------------- update h set workid=a.empno
from hremployee h,l_ls a where h.cardid=a.cardid ------解决方案-------------------- hremployee 说明你这个表的东西并没有完全在l_ls里面。 ------解决方案-------------------- 试试
UPDATE a
SET A.workid = b.empno
FROM hremployee a
INNER JOIN ( SELECT empno ,
cardid
FROM l_ls
WHERE empno IS NOT NULL
) b ON a.cardid = b.cardid