Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UPDATE multiple items in JOIN

Status
Not open for further replies.

Shelby500

IS-IT--Management
Oct 16, 2013
44
0
0
US
Can someone tell me why this is allowed:
Code:
update
(select su.sec_usr_id,su.is_enbl_ind,t.asn_usr_id,t.stat_typ_cd,su.lst_updt_dt
  from sec_usr su, tsk t
  where su.is_enbl_ind = 0
  and su.sec_usr_id = t.asn_usr_id
  and t.stat_typ_cd = 'OPEN')u
set u.stat_typ_cd = 'CLOSED';

but this is not allowed and can I do this below without using MERGE or CURSORs?
Code:
update
(select su.sec_usr_id,su.is_enbl_ind,t.asn_usr_id,t.stat_typ_cd,su.lst_updt_dt
  from sec_usr su, tsk t
  where su.is_enbl_ind = 0
  and su.sec_usr_id = t.asn_usr_id
  and t.stat_typ_cd = 'OPEN')u
set u.stat_typ_cd = 'CLOSED',
u.lst_updt_dt = sysdate;
 
you can't update both as they belong to 2 different tables.
stat_typ_cd is from tsk
lst_updt_dt is from sec_usr



Regards

Frederico Fonseca
SysSoft Integrated Ltd

FAQ219-2884
FAQ181-2886
 
So an UPDATE query cannot be used to update two tables? UPDATEs can only be used to update one table and anything over one table has to use a MERGE?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top