日期:2014-05-18  浏览次数:20376 次

update ,值从另外一个表查询
update gh_ghzdk set ghrq=(select ghrq from test where test.blh=gh_ghzdk.blh)

出错信息:
服务器: 消息 512,级别 16,状态 1,行 3
子查询返回的值多于一个。当子查询跟随在 =、!=、<、<=、>、>= 之后,或子查询用作表达式时,这种情况是不允许的。
语句已终止。


请问该怎么写

------解决方案--------------------
update gh_ghzdk set ghrq=a.ghrq from test a where a.blh=gh_ghzdk.blh)
------解决方案--------------------
update A
set A.ghrq = B.ghrq
from gh_ghzdk A,test B
where B.blh=A.blh