首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

update语句出错,求指正解决方法

2012-01-21 
update语句出错,求指正update t_marketset t_market.tellernamet_teller.name where t_market.telleridt

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);

热点排行