mysql - Update two different columns with a separate WHERE condition for each -
i wanna update 2 columns on table different conditions each one. i've looked on , cant seem find solution anywhere matches exact thing. wanna have this:
update users set col1= 'name1' id=3 , col2='name1' id=10
you case
expression:
upadate users set col1 = case when id=3 'name1' else col1 end, col2 = case when id=10 'name1' else col2 end id in (3, 10)
but find syntax awkward, , might rather logically separate updates not using case
in separate commands within single transaction.
Comments
Post a Comment