update tb2 set value=tb1.new_value from tb1,tb2 where tb1.OLD_VALUE=tb2VALUE
update 表2 set value=表1.new_value from 表1 where 表1.old_value=表2.value
Update 表2 value=(Select New_value From 表1,表2 Where 表1.old_value=表2.value)
Update 表2 value=(Select New_value From 表1,表2 Where 表1.old_value=表2.value)
to pbsql(风云) : The column prefix '表1' does not match with a table name or alias name used in the query.
to zilang(随意的风): Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. The statement has been terminated.
create table 表1 (old_value varchar(10),new_value varchar(20)) insert 表1 select 'abc' , '123' union all select 'zzz' , '999' union all select 'dee' , '345'create table 表2 (value varchar(10)) insert 表2 select 'abc' union all select 'zzz' union all select 'xdfe' union all select 'zzz' union all select 'abc' union all select 'cde' union all select 'dee'update 表2 set value=表1.new_value from 表2 inner join 表1 ON 表2.value=表1.old_value select * from 表2 drop table 表1 drop table 表2
The column prefix '表1' does not match with a table name or alias name used in the query.
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.
insert 表1 select 'abc' , '123'
union all select 'zzz' , '999'
union all select 'dee' , '345'create table 表2 (value varchar(10))
insert 表2 select 'abc'
union all select 'zzz'
union all select 'xdfe'
union all select 'zzz'
union all select 'abc'
union all select 'cde'
union all select 'dee'update 表2 set value=表1.new_value from 表2 inner join 表1 ON 表2.value=表1.old_value
select * from 表2 drop table 表1
drop table 表2