update语句出错,求指正

hinada99 2011-11-20 04:03:24
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? 出错

...全文
99 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
hinada99 2011-11-21
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 jcback 的回复:]

两张表没连接关系
update t_market set tellername=(select name from t_teller where id=t_market.tellerid);
[/Quote]

谢谢。
merrill 2011-11-21
  • 打赏
  • 举报
回复
update t_market
set t_market.tellername = t_teller.name
where exists
(select 1 from t_teller where t_teller.id = t_market.tellerid);
huangdh12 2011-11-20
  • 打赏
  • 举报
回复
[Quote=引用楼主 hinada99 的回复:]
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? 出错
[/Quote] update 语句写错了吧 是不是少了空格? 而且 ,你后面如果要用别名的话,前面表也要加别名才对。
jcback 2011-11-20
  • 打赏
  • 举报
回复
两张表没连接关系
update t_market set tellername=(select name from t_teller where id=t_market.tellerid);
hinada99 2011-11-20
  • 打赏
  • 举报
回复
补充:
使用的命令软件是 PL/SQL Developer 的 命令窗口

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧