【问题标题】:Oracle update statement involving two tables (but not copying the data from the other table)涉及两个表的 Oracle 更新语句(但不从另一个表中复制数据)
【发布时间】:2016-08-22 17:21:12
【问题描述】:

这可能很难解释,但我有两个表:

create table UserInputMovie
(
movid varchar2(7),
MUcomment varchar2(50),
MUname varchar2(25),
MUrating number(2)
);

create table TempMProfiles
(
movid varchar2(7),
mname varchar2(25),
mdesc varchar2(80)
);

我在这里要做的是让它更新MUratingMUcomment,其中TempMProfilesmovidUserInputMovie 相同。

【问题讨论】:

  • 其中 TempMProfiles 的 movid 与 UserInputMovie 的 movid 相同。

标签: php html sql oracle


【解决方案1】:

类似于SELECT,您需要一个WHERE-条件来查找匹配的行:

update UserInputMovie
set <whatever>
where exists
 (
   select * 
   from TempMProfiles  
   where TempMProfiles.movid  = UserInputMovie.movid
 )

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-09-26
    • 1970-01-01
    • 1970-01-01
    • 2012-12-25
    • 2018-07-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-18
    相关资源
    最近更新 更多