Closed baolingz closed 4 years ago
SELECT COUNT(*) FROM dep_cats_permits.latest
WHERE TRIM(status) != 'CANCELLED'
AND LEFT(applicationid, 1) != 'G'
AND (LEFT(applicationid, 1) != 'C' OR (requesttype != 'REGISTRATION' AND requesttype != 'REGISTRATION INSPECTION' AND requesttype != 'BOILER REGISTRATION II'))
AND (LEFT(applicationid, 2) != 'CA' OR requesttype != 'WORK PERMIT' OR TRIM(status) != 'EXPIRED')
;
Purge the
dep_cats_permits
using the following logicAll Cancelled permits All G-prefix permits All C-prefix + Registration (including Registration, Boiler Registration II, and Registration Inspection) All CA-Prefix + Work Permit + Expired permits