Update bulk row in mysql database in single query


UPDATE tbl_update SET Code= (
case
when ID = ‘7’ then ‘A2M2’
when ID = ‘8’ then ‘A2M3’
when ID = ‘9’ then ‘A2M4′
when ID = ’10’ then ‘A2M5′
when ID = ’11’ then ‘A2M9’
end
) WHERE ID IN (‘7′,’8′,’9′,’10’,’11’)

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s