UPDATE a SET a.KeyNum=(SELECT COUNT(b.CI_ID) from myTab.dbo.CI_SinKey as b where CONTAINS(b.SearchKey,a.KeyName) ) from myKey.dbo.SearchKey as a where KeyNum=0
这个是错误的语句,相信大家可以看懂我的业务需求,我再描述一下 两个库:myKey myTab 对应表:SearchKey CI_SinKey SearchKey 这里出现字段:KeyNum(关键词匹配数据总量) KeyName(关键词) CI_SinKey 这里出现字段:CI_ID(默认ID) SearchKey(关键词) 业务需求:更新 myKey 库 SearchKey 表 KeyNum为O的记录 的 KeyNum(关键词匹配数据总量) 使 KeyNum=SELECT COUNT(b.CI_ID) from myTab.dbo.CI_SinKey as b where CONTAINS(b.SearchKey,a.KeyName))