will41 Posted August 31, 2011 Share Posted August 31, 2011 hi how is everyone today? this is my first post i have a table that has 4 columns id formation type image path what i need is to update sevral rows for the type when it matches the id i have tried update set type = 2 where id = 2 and id = 4 that didnt work tried update set type = 2 where id = 2,4 that did not work tried UPDATE `plays` SET `type`= CASE WHEN `id`=2 THEN `type` = 2 WHEN `id`=4 THEN `type` = 2 ELSE THEN `type' END WHERE `ID` IS NOT NULL did not work Can someone help me with this thanks wil41 Link to comment https://forums.phpfreaks.com/topic/246120-updating-several-rows/ Share on other sites More sharing options...
PFMaBiSmAd Posted August 31, 2011 Share Posted August 31, 2011 update your_table set type = 2 where id = 2 or id = 4 or update your_table set type = 2 where id in(2,4) Link to comment https://forums.phpfreaks.com/topic/246120-updating-several-rows/#findComment-1263963 Share on other sites More sharing options...
will41 Posted August 31, 2011 Author Share Posted August 31, 2011 thanks so much that woked like a charm Link to comment https://forums.phpfreaks.com/topic/246120-updating-several-rows/#findComment-1263974 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.