sql - How to update column from same column in similiar table -


i need copy column 1 table new column in table, following error.

single-row subquery returns more 1 row

this statement:

update order set  name2 = (select name old order); 

you have set join condition betwwen 2 tables; select return rows table; example:

create table zzztemp1 (id1 integer, name1 varchar2(100)); create table zzztemp2 (id2 integer, name2 varchar2(100));   insert zzztemp1 values(1, 'joe'); insert zzztemp1 values(2, 'albert'); insert zzztemp1 values(3, 'jack');   insert zzztemp2 values(1, null); insert zzztemp2 values(2, null); insert zzztemp2 values(3, null);   update zzztemp2 set name2=(select name1 zzztemp1  zzztemp2.id2=zzztemp1.id1);  select * zzztemp2;  rollback;   drop table zzztemp1; drop table zzztemp2; 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -