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

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -