Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004
    Location
    Terre Haute, IN
    Posts
    7

    Question Unanswered: 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

  2. #2
    Join Date
    Feb 2004
    Location
    Terre Haute, IN
    Posts
    7
    Anyone with any help?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •