日期:2014-05-17  浏览次数:20901 次

update语句出错,求指正
update t_marketset t_market.tellername=t_teller.name where t_market.tellerid=t_teller.id;
报错
ORA-00904: "t_teller"."id": 标识符无效;

但是
select t_teller.id from t_teller ;却能够查出记录。
why? 出错



------解决方案--------------------
两张表没连接关系
update t_market set tellername=(select name from t_teller where id=t_market.tellerid);
------解决方案--------------------
探讨
update t_marketset t_market.tellername=t_teller.name where t_market.tellerid=t_teller.id;
报错
ORA-00904: "t_teller"."id": 标识符无效;

但是
select t_teller.id from t_teller ;却能够查出记录。
why? 出错

------解决方案--------------------
update t_market
set t_market.tellername = t_teller.name
 where exists
 (select 1 from t_teller where t_teller.id = t_market.tellerid);