求一条SQL语句(10分)

S

sxd2002

Unregistered / Unconfirmed
GUEST, unregistred user!
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
...
数据库为 delphi6==>paradox!
 
update table2
set name=(select name from table1 where id=table2.id)
 
update table2 set name=(select table1.name from table1 where table1.id=
table2.id) where if exists (select * from table1 where table1.id=table2.id)
我在MSSQL下通过.paradox 没试.
 
上面的方法不行,必须用INSERT TO
 
不能用insert语句吧。是修改问题,感觉quicksilver的
update table2 set name=(select name from table1 where id=table2.id)
应该正确
要不试验一下
1.update table2 set table2.name=table1.name where table1.id=table2.id
2.update table1,table2 set table2.name=table1.name where table1.id=table2.id
第2是Access中的语法,不知道paradox是否可以?
 
顶部