/*
Contacts with Deceased in First Name (before creating deceased_c field)
SELECT c.id, c.first_name
FROM contacts c
WHERE
(
  c.first_name LIKE '%Deceased %'
  OR
  c.first_name LIKE '%DECEASED %'
  OR
  c.first_name LIKE '%Deceased%'
  OR
  c.first_name LIKE '%DECEASED%'
);
*/
/*
Contacts with Deceased in First Name OR deceased_c = 1
SELECT c.id, c.first_name, cs.deceased_c
FROM contacts c, contacts_cstm cs
WHERE c.id = cs.id_c AND
(
  c.first_name LIKE '%Deceased %'
  OR
  c.first_name LIKE '%DECEASED %'
  OR
  c.first_name LIKE '%Deceased%'
  OR
  c.first_name LIKE '%DECEASED%'
);
*/

UPDATE contacts c, contacts_cstm cs SET cs.deceased_c = 1, c.first_name = REPLACE(c.first_name,'Deceased ','') where c.id = cs.id_c AND c.first_name LIKE '%Deceased %';

UPDATE contacts c, contacts_cstm cs SET cs.deceased_c = 1, c.first_name = REPLACE(c.first_name,'DECEASED ','') where c.id = cs.id_c AND c.first_name LIKE '%DECEASED %';

UPDATE contacts c, contacts_cstm cs SET cs.deceased_c = 1, c.first_name = REPLACE(c.first_name,'Deceased','') where c.id = cs.id_c AND c.first_name LIKE '%Deceased%';

UPDATE contacts c, contacts_cstm cs SET cs.deceased_c = 1, c.first_name = REPLACE(c.first_name,'DECEASED','') where c.id = cs.id_c AND c.first_name LIKE '%DECEASED%';
