update gh_ghzdk set ghrq=(select ghrq from test where test.blh=gh_ghzdk.blh)出错信息:
服务器: 消息 512,级别 16,状态 1,行 3
子查询返回的值多于一个。当子查询跟随在 =、!=、<、<=、>、>= 之后,或子查询用作表达式时,这种情况是不允许的。
语句已终止。
请问该怎么写

解决方案 »

  1.   

    update gh_ghzdk set ghrq=a.ghrq from test a where a.blh=gh_ghzdk.blh)
      

  2.   

    update A
    set A.ghrq = B.ghrq
    from gh_ghzdk A,test B 
    where B.blh=gh_ghzdk.blh
      

  3.   

    update A
    set A.ghrq = B.ghrq
    from gh_ghzdk A,test B  
    where B.blh=A.blh
      

  4.   

    update gh_ghzdk set ghrq=(select top 1 ghrq from test where test.blh=gh_ghzdk.blh order by ghrq)update gh_ghzdk set ghrq=(select max(ghrq) from test where test.blh=gh_ghzdk.blh)update gh_ghzdk set ghrq=(select min(ghrq) from test where test.blh=gh_ghzdk.blh)update gh_ghzdk set ghrq = n.ghrq 
    from gh_ghzdk m , test n 
    where m.blh=n.blh 
      

  5.   


    soryy,结贴的时候还没看到回复