If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Update Query - Is there a better solution? Sun Solaris DB2 Version 8

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-12-04, 09:32
ccsoftball7 ccsoftball7 is offline
Registered User
 
Join Date: Feb 2004
Location: Terre Haute, IN
Posts: 7
Question Update Query - Is there a better solution? Sun Solaris DB2 Version 8

I need to update a table from another table by joining them on APP_ID_NBR. I will set the ACCT_NBR = the ACCT_NBR on the subsequent select. Is there a more efficient way to write the query?



update $USER.${SANDBOX}BACKFILL A
set (ACCT_NBR
,LAST_MODIFIED_DATE) = (select B.ACCT_NBR
,CURRENT TIMESTAMP
from NMFP.KNSTG B
where A.APP_ID_NBR = B.APP_ID_NBR)
where ACCT_NBR IS NULL
and exists (select *
from NMFP.KNSTG C
where A.APP_ID_NBR = C.APP_ID_NBR);

COMMIT;

Thanks in advance.

Jeff
Reply With Quote
  #2 (permalink)  
Old 07-14-04, 09:36
ccsoftball7 ccsoftball7 is offline
Registered User
 
Join Date: Feb 2004
Location: Terre Haute, IN
Posts: 7
Anyone with any help?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On