update t1
set t1.fmodel=t1.FName+t1.FHelpcode+(select F_103 from t_ICitem where FItemID in (select FItemID from t_icitemcore))
from t_icitemcore t1 如何将 F_103当成一个条记录来处理。。
set t1.fmodel=t1.FName+t1.FHelpcode+(select F_103 from t_ICitem where FItemID in (select FItemID from t_icitemcore))
from t_icitemcore t1 如何将 F_103当成一个条记录来处理。。
set t1.fmodel=t1.FName+t1.FHelpcode+t.F_103
from t_icitemcore t1,t_ICitem t
where t.FItemID = t1.FItemID
--这样试试,操作前最好备份一下
set fmodel = t.FName + t.FHelpcode + m.f_103
from t_icitemcore t , t_ICitem m
where t.FItemID = m.FItemID
set t1.fmodel=t1.FName+t1.FHelpcode+(select F_103 from t_ICitem where FItemID in (select FItemID from t_icitemcore))
from t_icitemcore t1
这个语句有点问题:
当更新t_icitemcore的某一个fmodel时,你加上了t_ICitem表中任一个t_icitemcore表中有的FItemID所对应的F_103,换句话说,你的F_103的值是不确定的.这恐怕不行.
估计楼主是想要这样的效果:
update t1
set t1.fmodel=t1.FName+t1.FHelpcode+(select top 1 F_103 from t_ICitem where FItemID=t1.FItemID)
from t_icitemcore t1这样可能更说得通一些.
set t1.fmodel=t1.FName+t1.FHelpcode+(select max(F_103) from t_ICitem where FItemID in (select FItemID from t_icitemcore))
from t_icitemcore t1
根源是这个子查询有多个值
set t1.fmodel=t1.FName+t1.FHelpcode+(select F_103 from t_ICitem where FItemID =(select max(FItemID) from t_icitemcore))
from t_icitemcore t1