Multiple update in single db2 sql query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gandhi koolpandi
    New Member
    • Dec 2006
    • 1

    #1

    Multiple update in single db2 sql query

    Hi,

    I want to update column A based on the column B.

    the syntax is like that : update table (tablename)
    set column A=12 when column B=10
    set column A=15 when column B=14
    set column A=122 when column B=133
    end
    i dont know the correct syntax.plz do reply if anyone knows.
  • Herb
    New Member
    • Sep 2006
    • 13

    #2
    look at the CASE function.... you may have to update all 3 columns and set them back to there current value if they dont pass the case expression

    Comment

    Working...