奇怪。为什么不直接:
update a set a.id = 03001 where a.user_id = '02040001' and a.dept_id = '0601'
呢?就一条记录嘛!如果你需要修改多条的话,可能是别的记录有问题。

解决方案 »

  1.   

    两个表的问题现在解决了。出现三表的问题了。
    update a
    set a.id = 
    (
    select c.id
    from b,c
    where b.num = a.num
    and b.num = c.num
    and c.dept_id = '0601')
    where a.user_id = '02040001'
    and a.dept_id = '0601';
    提示我无法将a.id更新为NULL
    但执行:
    select c.id
    from a,b,c
    where b.num = a.num
    and b.num = c.num
    and c.dept_id = '0601'
    where a.user_id = '02040001'
    and a.dept_id = '0601';
    返回值为'03001'
    求助啊。苦恼死我了。
      

  2.   

    update a
    set a.id=(select c.id from a,b,c where b.num = a.num and and b.num = c.num
    and a.user_id = '02040001' and a.dept_id = '0601')
    沒有測試,你自己看看
      

  3.   

    update a
    set a.id=(select c.id from a,b,c where b.num = a.num and and b.num = c.num
    and a.user_id = '02040001' and a.dept_id = '0601')
    where a.user_id = '02040001'
    and a.dept_id = '0601';