Hello All,
I have taken what others have suggested and was able to rewrite the script using only sql so that I could do it with a few other scripts that do thing automaticaly, like grabbing file from a site, unzipping, uploading and now it will do the filter all in one shot and use mostly only one server at a time when running the script.
Any how here is the code that I have come up with and I would like any feed back on making it better:
DELETE FROM irs_rawdata
WHERE EXISTS
(
SELECT fin
FROM block
);
INSERT INTO query SELECT * FROM irs_rawdata
WHERE
PNO LIKE '%blind%' OR
PNO LIKE '%deaf%' OR
PNO LIKE '%braille%' OR
PNO LIKE '%sight%' OR
PNO LIKE '%vision%' OR
PNO LIKE '%sign%' OR
PNO LIKE '%ear%' OR
PNO LIKE '%eye%' OR
PNO LIKE '%dog%' OR
Activity_Code LIKE '%031%' OR
NTEE_Code LIKE '%G41%' OR
NTEE_Code LIKE '%G42%' OR
NTEE_Code LIKE '%H41%' OR
NTEE_Code LIKE '%H42%' OR
NTEE_Code LIKE '%P86%' OR
NTEE_Code LIKE '%P87%';
DELETE FROM irs_rawdata
WHERE
PNO LIKE '%blind%' OR
PNO LIKE '%deaf%' OR
PNO LIKE '%braille%' OR
PNO LIKE '%sight%' OR
PNO LIKE '%vision%' OR
PNO LIKE '%sign%' OR
PNO LIKE '%ear%' OR
PNO LIKE '%eye%' OR
PNO LIKE '%dog%' OR
Activity_Code LIKE '%031%' OR
NTEE_Code LIKE '%G41%' OR
NTEE_Code LIKE '%G42%' OR
NTEE_Code LIKE '%H41%' OR
NTEE_Code LIKE '%H42%' OR
NTEE_Code LIKE '%P86%' OR
NTEE_Code LIKE '%P87%';
INSERT INTO block (`fin`, `who_blocked`)
SELECT EIN, 'S-123456789' FROM irs_rawdata
WHERE
PNO NOT LIKE '%blind%' OR
PNO NOT LIKE '%deaf%' OR
PNO NOT LIKE '%braille%' OR
PNO NOT LIKE '%sight%' OR
PNO NOT LIKE '%vision%' OR
PNO NOT LIKE '%sign%' OR
PNO NOT LIKE '%ear%' OR
PNO NOT LIKE '%eye%' OR
PNO NOT LIKE '%dog%' OR
Activity_Code NOT LIKE '%031%' OR
NTEE_Code NOT LIKE '%G41%' OR
NTEE_Code NOT LIKE '%G42%' OR
NTEE_Code NOT LIKE '%H41%' OR
NTEE_Code NOT LIKE '%H42%' OR
NTEE_Code NOT LIKE '%P86%' OR
NTEE_Code NOT LIKE '%P87%';
DELETE FROM irs_rawdata;
Sincerely,
Christopher