update 联系人 set 联系人.单位ID=单位.ID
from 单位,联系人
where 单位.名称=联系人.单位
      and 联系人.单位ID is null

解决方案 »

  1.   

    Error in CUpdateDB Class: update 联系人 set 联系人.单位ID = 单位.ID from (select 单位.ID from 单位 where 单位.名称 = 联系人.单位) where 联系人.单位ID is null
    语法错误 (操作符丢失) 在查询表达式 '单位.ID from (select 单位.ID from 单位 where 单位.名称 = 联系人.单位)' 中。
      

  2.   

    update 联系人 set 联系人.单位ID=
                      (select 单位.ID
                       from 单位,联系人
                       where 单位.名称=联系人.单位)
                  where 联系人.单位ID is null
    这样试试吧!
      

  3.   

    update <tablename> set <col=value, col=value, ......> where condition注意了,value的值不能用Select * ...代替。只能在where condition中过滤条件。另外,如果是SQL数据库,执行update的用户必须要有update权限,如果是Access97/2000,就不能用update语句了,必须要用rs.update要更新数据。
      

  4.   

    update 联系人,单位 
    set 联系人.单位ID = 单位.ID 
    where 联系人.单位ID is null and 联系人.单位=单位.名称在Access下通过了。