Jump to content

[SOLVED] updating the same column in multiple rows...


lordvader

Recommended Posts

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.