Mysql Case - 2 conditions need same update value -


I am trying to use a mysql case query to update several rows in the table. I have some issues that want to update the line with the same value. I was wondering if it is possible to put all of them in one case or do I have to create a new 'WHEN' for each?

What I'm trying to do below, but this is obviously not the right way to do this because I get an error.

  UPDATE `group 'SET` condition` = case` group_id` when 32 or 33 then' 1 'when 31' 2 'END   

Is it possible to do something like this?

Thanks

TRY

  UPDATE` Tablename` SET `condition` = IF ('group_id = 31', 2,1)   

EDIT
  updated tagname SET` condition` = IF ( Group_id IN (31, 32), 2, 1) WHERE section_id = 1   

or

  updated tagname SET `status` = IF (Group_ID) (31, 32), 2, 1) WHERE section_id = 1   

Successfully running on my table..What is the error facing me ??

Other syntax
  UPDATE `filename 'SET` group_id` = case when in group_id (31,32) then 1 WHEN group_id IN (33,34) THEN 2 END    

Comments