oicq63236 发表于 2009-10-13 19:44

UPDATE之WHERE问题?

表T1,T2
现在想修改T2中的HM字段,但得以T1的zh为条件,下面是偶写得语句,但是行不通。(t1与t2之间用khh做关联)



sql "update t2 set hm='张三' where t1='20001001' and t2.khh=t1.khh"


提示217:column (khzhglb) not found in any table in the query .........

请大家帮着修改一下语句。。谢谢了。

yunzhongyue 发表于 2009-10-14 09:42

update t2 set hm=(select zh from t1 where t2.khh=t1.khh and t1='20001001' )
这样可以不?

胡李天 发表于 2009-10-17 13:13

二楼的真搞笑!
update t2 set hm='zhang3' where khh in (selectt1.khh from t1 where t1.column='20001001');
页: [1]
查看完整版本: UPDATE之WHERE问题?