lordvader Posted May 5, 2008 Share Posted May 5, 2008 Lets say I want to increment column "totals" in several different rows: UPDATE mytable SET totals=totals+1 WHERE id=1 OR id=3 OR id=7 OR (dozens more...) Is this the fastest syntax? Or is CASE WHEN THEN better? Or is there an even better way? Thanks By the way, I can't update every row's 'totals' column, only specific rows. Link to comment https://forums.phpfreaks.com/topic/104261-solved-updating-the-same-column-in-multiple-rows/ Share on other sites More sharing options...
fenway Posted May 5, 2008 Share Posted May 5, 2008 try id IN ( 1,3,7,etc.) Link to comment https://forums.phpfreaks.com/topic/104261-solved-updating-the-same-column-in-multiple-rows/#findComment-533779 Share on other sites More sharing options...
lordvader Posted May 5, 2008 Author Share Posted May 5, 2008 Thanks Link to comment https://forums.phpfreaks.com/topic/104261-solved-updating-the-same-column-in-multiple-rows/#findComment-533835 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.