i added new column existing table. want populate value retrieve table.
table: export
name | email | employeeid | userid table: user
id | name | email | idnumber the new column export.userid, want equal out user.id. please note id , idnumber are not same - idnumber stores employeeid while id auto-increment pk. user.idnumber equal export.employeeid.
i want populate export.userid user.id when export.employeeid = user.idnumber.
how can oracle-compatible sql-code?
i tried following, throws me error.
update export set userid = ( select id user user.idnumber = export.employeeid , user.email = export.email) exists( select 1 user user.idnumber = export.employeeid , user.email = export.email) but error
[error] execution (2: 19): ora-01427: single-row subquery returns more 1 row
probably, subquery returns more 1 row given email , idnumber:
select id user user.idnumber = export.employeeid , user.email = export.email try using distinct exclude duplicates:
select distinct id user user.idnumber = export.employeeid , user.email = export.email or add sample data question. unique key of tables user , export?
Comments
Post a Comment