table1         table2
ID   NAME     ID   NAME  WORK
1     a       1           teacher
2     b       2           student 
3     c       3           student
4     d       4           teacher
...
其中ID唯一如何UPDATE使table2为
ID   NAME    WORK
1     a      teacher
2     b      student 
3     c      student
4     d      teacher
...

解决方案 »

  1.   

    update table2 set name=(select name from table1) where table2.id=table1.id
      

  2.   

    update table2 set name=(select name from table1 where id=table2.id)
      

  3.   

    我在access里这样写:
    update table2 inner join table1 on table2.id=table1.id set name=table1.name
      

  4.   

    update table2 set table2.name=table1.name 
    from table1,table2
    where table1.id=table2.id
      

  5.   

    data==> paradox
        上面的高手说的都不对!
      

  6.   

    update table2 set name=(select name from table1) and work=(select work from table1) 可以吗?(我没有试过)