Results 1 to 2 of 2

Thread: Update Syntax

  1. #1
    Join Date
    Dec 2004
    Location
    MN, USA
    Posts
    4

    Unanswered: Update Syntax

    Hi,

    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
    Posts
    4,292
    Provided Answers: 5
    update mytable as m set lastip = (select host from mytable as x where x.ip = m.lastip)

    Andy

Posting Permissions

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