View Single Post
Old 09-24-2012, 04:07 PM   PM User | #1
shaunthomson
New Coder

 
Join Date: May 2012
Posts: 89
Thanks: 51
Thanked 0 Times in 0 Posts
shaunthomson is an unknown quantity at this point
Multiple row updates

Gidday

Just wondering how, using one query, to update a counter column with + 1 in multiple rows when the row ids are supplied.

So:

UPDATE table
SET col=col+1
WHERE id in (1,2,3)

This doesn't work. It does work if the value of col is static. Is it possible, or will I have to create a separate query for each row update?

Thanks for your help.
shaunthomson is offline   Reply With Quote