Results 1 to 2 of 2

Thread: Update Syntax

  1. #1
    Join Date
    Dec 2004
    MN, USA

    Unanswered: Update Syntax


    I have an update question: Using DB2 UDB v8, FP9a.

    I have a tables that look like this:

    IP Host LastIP
    --- ---- -------
    001 BM1 003
    002 BM2 003
    003 BM3 002

    I need to update LastIP so it equal to the value of Host when comparing Host to IP. So I need it to look like this after the update:

    IP Host LastIP
    --- ---- -------
    001 BM1 BM3
    002 BM2 BM3
    003 BM3 BM2

    I am getting stuck on the sql.

    Thanks if you can help or point me in the right direction!

  2. #2
    Join Date
    Jan 2003
    Provided Answers: 5
    update mytable as m set lastip = (select host from mytable as x where x.ip = m.lastip)


Posting Permissions

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