Please try:update table1 set name=(select table2.name from table2,table1 where table2.num=table1.num) where num in (select num from table2.num)
update table1 set name = table2.name from table2 where table1.num = table2.num
update table1 set table1.name=(select table2.name from table2 where table2.num=num) where table1.num in (select num from table2)
update table1 from table2 set name=talbe2.name where num=table2.num
if exists (SELECT table2.[name] from table2 ,table1 where table1.num=table2.num) begin declare @aa varchar(20) declare aa cursor for SELECT table2.[name] from table2 ,table1 where table1.num=table2.num open aa fetch next from aa into @aa while @@fetch_status=0 begin update table1 set [name]=@aa where current of aa fetch next from aa into @aa end close aa deallocate aa end
set name=(select table2.name from table2,table1 where table2.num=table1.num)
where num in (select num from table2.num)
set table1.name=(select table2.name from table2 where table2.num=num)
where table1.num in (select num from table2)
where num=table2.num
where table1.num=table2.num)
begin
declare @aa varchar(20)
declare aa cursor for
SELECT table2.[name] from table2 ,table1 where table1.num=table2.num
open aa
fetch next from aa into @aa
while @@fetch_status=0
begin
update table1
set [name]=@aa
where current of aa
fetch next from aa into @aa
end
close aa
deallocate aa
end
高手啊!!!
我等低手真是自叹不如