Jump to content

Multiple update statements


Jonob

Recommended Posts

I have a query as follows:

UPDATE customer
SET account_id = account_id + 1
WHERE code = 1800

 

However, what I would like to do is update multiple lines, each with different criteria; something like:

UPDATE customer
SET account_id = account_id + 1 WHERE code = 1800
SET account_id = account_id + 2 WHERE code = 2000
SET account_id = account_id + 3 WHERE code = 2400

 

But this obviously wont work.

 

Any ideas on the most efficient way to write this would be appreciated.

Link to comment
https://forums.phpfreaks.com/topic/190559-multiple-update-statements/
Share on other sites

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.