1. For remove or replace Mobile number from database for all industry type use below query -


UPDATE alarmmaster am JOIN devicemaster dm ON am.deviceid = dm.deviceid JOIN plantmaster pm ON pm.plantid=dm.plantid

JOIN industrytypemaster im ON pm.IndustryType = im.IndustryTypeId

SET am.SendSMSTo = REPLACE(SendSMSTo, 'Mobile number which need replace;', 'Mobile number with whom need to replace');


Example,


Remove Contact - For remove contact keep blank in second colleen.


UPDATE alarmmaster am JOIN devicemaster dm ON am.deviceid = dm.deviceid JOIN plantmaster pm ON pm.plantid=dm.plantid

JOIN industrytypemaster im ON pm.IndustryType = im.IndustryTypeId

SET am.SendSMSTo = REPLACE(SendSMSTo, '7839891856;', '');


Replace contact - For replace contact in first colleen put which need replace and second colleen with whom need to replace.


UPDATE alarmmaster am JOIN devicemaster dm ON am.deviceid = dm.deviceid JOIN plantmaster pm ON pm.plantid=dm.plantid

JOIN industrytypemaster im ON pm.IndustryType = im.IndustryTypeId

SET am.SendSMSTo = REPLACE(SendSMSTo, '7839891856;', '7839891792');


2. For remove or replace Mobile number from database for particular industry type use below query -


UPDATE alarmmaster am JOIN devicemaster dm ON am.deviceid = dm.deviceid JOIN plantmaster pm ON pm.plantid=dm.plantid

JOIN industrytypemaster im ON pm.IndustryType = im.IndustryTypeId

SET am.SendSMSTo = REPLACE(SendSMSTo, 'Mobile number which need replace;''Mobile number with whom need to replace') WHERE im.IndustryType = 'Industry type';



Example,


Remove Contact - For remove contact keep blank in second colleen and add respective Industry type.


UPDATE alarmmaster am JOIN devicemaster dm ON am.deviceid = dm.deviceid JOIN plantmaster pm ON pm.plantid=dm.plantid

JOIN industrytypemaster im ON pm.IndustryType = im.IndustryTypeId

SET am.SendSMSTo = REPLACE(SendSMSTo, '7839891856;', '') WHERE im.IndustryType = 'Distillery';


Replace contact - For replace contact in first colleen put which need replace and second colleen with whom need to replace and add respective Industry type. 


UPDATE alarmmaster am JOIN devicemaster dm ON am.deviceid = dm.deviceid JOIN plantmaster pm ON pm.plantid=dm.plantid

JOIN industrytypemaster im ON pm.IndustryType = im.IndustryTypeId

SET am.SendSMSTo = REPLACE(SendSMSTo, '7839891856;', '7839891792') WHERE im.IndustryType = 'Distillery';



Note :- you can add multiple Contact's with use (;) at end of Contact.