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. Quote 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.) Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.