SET SQL_SAFE_UPDATES = 0;

UPDATE `log_all_sales_new` SET `beneficiary` = REPLACE(REPLACE(REPLACE(REPLACE(`beneficiary`, '[', ''), ']', ''), '(', ''), ')', '')  WHERE  `beneficiary` LIKE '%[%' OR `beneficiary` LIKE '%]%' OR `beneficiary` LIKE '%(%' OR `beneficiary` LIKE '%)%';
UPDATE `log_all_sales_new` SET `beneficiary` = 'SK_10'   WHERE `beneficiary` IN ('|_club|','|club|');
UPDATE `log_all_sales_new` SET `beneficiary` = REPLACE(`beneficiary`, 'SK-', 'SK_')  WHERE  LEFT(`beneficiary`, 3) = 'SK-' ;
UPDATE `log_all_sales_new` SET `beneficiary` = CONCAT('SK_', `beneficiary`)  WHERE  beneficiary REGEXP '^[0-9]+$'  AND CAST(beneficiary AS UNSIGNED) BETWEEN 2 AND 99998;
UPDATE `log_all_sales_new` SET `beneficiary` = REPLACE(`beneficiary`, 'SK', 'SK_')  WHERE  LEFT(`beneficiary`, 2) = 'SK' AND MID(`beneficiary`, 3,1) BETWEEN '0' AND '9' ;
UPDATE `log_all_sales_new` SET `beneficiary` = REPLACE(`beneficiary`, '_SP', '')  WHERE  `beneficiary` LIKE '%_SP';
UPDATE `log_all_sales_new` SET `beneficiary` = TRIM(TRAILING 'C' FROM `beneficiary`) WHERE `beneficiary` LIKE '%C' AND `shop` LIKE '%Schecker%';
UPDATE `log_all_sales_new` SET `beneficiary` = REPLACE(REPLACE(beneficiary, '%5BSK', 'SK'), '%5D','') WHERE beneficiary LIKE '\%5BSK%' ;
UPDATE `log_all_sales_new` SET `beneficiary` = CONCAT('SK_',REPLACE(beneficiary, '|', '')) WHERE beneficiary LIKE '|%|' AND REPLACE(beneficiary, '|', '') = CEIL(REPLACE(beneficiary, '|', '')) ;