SELECT MAX(LENGTH(cs_jbstatusmail_fields)) FROM customer;

SELECT cs_jbstatusmail_fields, COUNT(*) AS num FROM customer GROUP BY cs_jbstatusmail_fields ORDER BY cs_jbstatusmail_fields LIMIT 0,1000

SELECT * FROM customer WHERE LENGTH(cs_jbstatusmail_fields) < 30

UPDATE customer SET cs_jbstatusmail_fields = CONCAT(cs_jbstatusmail_fields, '0000000000000000000000000000000000000000') WHERE LENGTH(cs_jbstatusmail_fields) < 30
--------------------------------------------------------------
SELECT cs_id, cs_eid, cs_jbstatusmail3, cs_jbstatusmail_fields FROM customer WHERE hq_id = '6' AND cs_jbstatusmail3 = '1' ORDER BY cs_id LIMIT 0,4000
SELECT cs_id, cs_eid, cs_jbstatusmail3, cs_jbstatusmail_fields FROM customer WHERE hq_id = '6' AND cs_jbstatusmail3 = '1' ORDER BY cs_jbstatusmail_fields LIMIT 0,4000 

SELECT cs_id, cs_eid, cs_jbstatusmail3, cs_jbstatusmail_fields, CONCAT(SUBSTRING(cs_jbstatusmail_fields,1,7), '1', SUBSTRING(cs_jbstatusmail_fields,9)) FROM customer WHERE hq_id = '6' AND cs_jbstatusmail3 = '1' ORDER BY cs_jbstatusmail_fields LIMIT 0,1000 
UPDATE customer SET cs_jbstatusmail_fields = CONCAT(SUBSTRING(cs_jbstatusmail_fields,1,7), '1', SUBSTRING(cs_jbstatusmail_fields,9)) WHERE hq_id = '6' AND cs_jbstatusmail3 = '1'

SELECT cs_jbstatusmail_fields, COUNT(*) AS num FROM customer WHERE hq_id = '6' GROUP BY cs_jbstatusmail_fields ORDER BY cs_jbstatusmail_fields LIMIT 0,1000 

SELECT SUBSTRING(cs_jbstatusmail_fields,1,7), count(*) AS num FROM `customer` WHERE hq_id = '6' AND cs_jbstatusmail3 = '1' GROUP BY SUBSTRING(cs_jbstatusmail_fields,1,7)
SELECT cs_id, cs_eid, cs_jbstatusmail3, cs_jbstatusmail_fields FROM `customer` WHERE hq_id = '6' AND cs_jbstatusmail3 = '1' AND SUBSTRING(cs_jbstatusmail_fields,1,7) != '0000000' ORDER BY cs_jbstatusmail_fields LIMIT 0,1000 
