update a
 set sname=b.sname
from 表1 a,表2 b
where a.sno=b.sno

解决方案 »

  1.   

    update 表1
     set sname=表2.sname
    from 表2
    where sno=表2.sno
      

  2.   

    这个送分的?update 表1
    set 表1.sname = 表2.sname
    from 表1,表2
    where 表1.sno = 表2.sno
      

  3.   

    update   表1 
    set   表1.sname   =   表2.sname 
    from   表1,表2 
    where   表1.sno   =   表2.sno 接点分
      

  4.   

    try:update a
    set a.sname=b.sname
    from 表1 a 
    left join 表2 b on a.sno=b.sno
      

  5.   

    update 表1
     set 表1.sname=表2.sname
    from 表1  on 表2 
    where 表1.sno=表2.sno
      

  6.   

    如果是SQL SERVER,不可能不行.create table tb1(sno int,sname varchar(10))
    insert into tb1 values(3,null)
    insert into tb1 values(5,null)
    insert into tb1 values(7,null)
    create table tb2(sno int,sname varchar(10))
    insert into tb2 values(1,'a') 
    insert into tb2 values(2,'b') 
    insert into tb2 values(3,'c') 
    insert into tb2 values(5,'d') 
    insert into tb2 values(7,'f') 
    goupdate tb1
    set tb1.sname = tb2.sname
    from tb1,tb2 
    where tb1.sno = tb2.snoselect * from tb1drop table tb1,tb2/*
    sno         sname      
    ----------- ---------- 
    3           c
    5           d
    7           f(所影响的行数为 3 行)
    */
      

  7.   


    是啊。SQL不肯能通不过的
    update a
     set sname=b.sname
    from 表1 a,表2 b
    where a.sno=b.sno
      

  8.   

    -->测试数据1: @1
    declare @1 table (sno tinyint,sname varchar(1))
    insert into @1
    select 3,null union all
    select 5,null union all
    select 7,null
    -->测试数据2: @2
    declare @2 table (sno tinyint,sname varchar(1))
    insert into @2
    select 1,'a' union all
    select 2,'b' union all
    select 3,'c' union all
    select 5,'d' union all
    select 7,'f'select * from @1
    /*
    sno  sname 
    ---- ----- 
    3    NULL
    5    NULL
    7    NULL
    */update a set a.sname=b.sname from @1 a inner join @2 b on a.sno=b.snoselect * from @1 --> OK
    /*
    sno  sname 
    ---- ----- 
    3    c
    5    d
    7    f
    */
      

  9.   

    我的是access数据库啊,上面都试了,说出现语法错误。
      

  10.   

    试一下这个!update 表1,表2 
    set 表1.sname=表2.sname
    where 表1.sno=表2.sno
      

  11.   

    上面的都不行,我用的是access数据库,所以高手们也要用access数据库做实验,可能很多在sql server可以实现的语句在access中可能实现不了吧。给对了马上给分,在线等。
      

  12.   

    唉 我机器上只有Access 2007 NND 以前Access2003那么熟 现在进去都不知道怎么用了 折腾了5分钟才调出SQL窗口 执行的时候报错 查个联机帮助还要安装然后重启机器 我是接不到你的fin了
      

  13.   

    declare @表1 table (sno int,sname varchar(10))
    insert into @表1 select 3,''
    insert into @表1 select 5,''
    insert into @表1 select 7,''
    declare @表2 table (sno int,sname varchar(10))
    insert into @表2 select 3,''
    insert into @表2 select 3,''
    insert into @表2 select 3,'c'
    insert into @表2 select 5,'d'
    insert into @表2 select 7,'f'update @表1  set sname=b.sname from @表2 b ,@表1 a where b.sno=a.snoselect * from @表1