the modifications have been applied as you recommended, but the problem still remains.
there are indeed long-lasting requests like :
SELECT COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B3. IS NOT NULL AND A1. = 4 AND B5. IS NOT NULL AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B5. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND B5. IS NOT NULL AND B5. REGEXP '\"?81(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B5. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND B5. IS NOT NULL AND B5. REGEXP '\"?82(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B5. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND B5. IS NOT NULL AND B5. REGEXP '\"?83(\"|,|$)|\"?84(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B3. IS NOT NULL AND A1. = 4 AND NOT A1. = 0 AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND NOT A1. = 0 AND B3. IS NOT NULL AND A1. = 4 AND NOT A1. = 0 AND A1. = 14 AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND NOT A1. = 0 AND B3. IS NOT NULL AND A1. = 4 AND NOT A1. = 0 AND A1. = 19 AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND NOT A1. = 0 AND B3. IS NOT NULL AND A1. = 4 AND NOT A1. = 0 AND A1. = 15 AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND NOT A1. = 0 AND B3. IS NOT NULL AND A1. = 4 AND NOT A1. = 0 AND A1. = 20 AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND NOT A1. = 0 AND B3. IS NOT NULL AND A1. = 4 AND NOT A1. = 0 AND A1. = 16 AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND NOT A1. = 0 AND B3. IS NOT NULL AND A1. = 4 AND NOT A1. = 0 AND A1. = 22 AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B6. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND B6. IS NOT NULL AND B6. REGEXP '\"?19(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B6. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND B6. IS NOT NULL AND B6. REGEXP '\"?18(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B3. IS NOT NULL AND A1. = 4 AND B6. IS NOT NULL AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B6. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND B6. IS NOT NULL AND B6. REGEXP '\"?17(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B6. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND B6. IS NOT NULL AND B6. REGEXP '\"?11(\"|,|$)|\"?12(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B6. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND B6. IS NOT NULL AND B6. REGEXP '\"?9(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND B3. IS NOT NULL AND A1. = 23 AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND NOT A1. = 0 AND B3. IS NOT NULL AND A1. = 4 AND NOT A1. = 0 AND A1. = 18 AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND NOT A1. = 0 AND B3. IS NOT NULL AND A1. = 4 AND NOT A1. = 0 AND A1. = 17 AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B6. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND B6. IS NOT NULL AND B6. REGEXP '\"?10(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B6. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND B6. IS NOT NULL AND B6. REGEXP '\"?13(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B6. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND B6. IS NOT NULL AND B6. REGEXP '\"?14(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B6. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND B6. IS NOT NULL AND B6. REGEXP '\"?15(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B6. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND B6. IS NOT NULL AND B6. REGEXP '\"?16(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B6. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND B6. IS NOT NULL AND B7. = '1' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B3. IS NOT NULL AND A1. = 4 AND B8. IS NOT NULL AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B8. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND B8. IS NOT NULL AND B8. REGEXP '\"?92(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B8. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND B8. IS NOT NULL AND B8. REGEXP '\"?93(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B8. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND B8. IS NOT NULL AND B8. REGEXP '\"?94(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B8. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND B8. IS NOT NULL AND B8. REGEXP '\"?95(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B8. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND B8. IS NOT NULL AND B8. REGEXP '\"?96(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND NOT A1. = 0 AND A1. = 14 AND B3. IS NOT NULL AND A1. = 4 AND NOT A1. = 0 AND A1. = 14 AND C0. = '1' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND NOT A1. = 0 AND A1. = 14 AND B3. IS NOT NULL AND A1. = 4 AND NOT A1. = 0 AND A1. = 14 AND C1. = '1' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND B3. IS NOT NULL AND A1. = 4 AND C2. IS NOT NULL AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND C2. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND C2. IS NOT NULL AND C2. REGEXP '\"?297(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND C2. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND C2. IS NOT NULL AND C2. REGEXP '\"?299(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND C2. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND C2. IS NOT NULL AND C2. REGEXP '\"?300(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND C2. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND C2. IS NOT NULL AND C2. REGEXP '\"?301(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND C2. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND C2. IS NOT NULL AND C2. REGEXP '\"?302(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN B3. IS NOT NULL AND A1. = 4 AND C2. IS NOT NULL AND B3. IS NOT NULL AND A1. = 4 AND C2. IS NOT NULL AND C2. REGEXP '\"?298(\"|,|$)' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN A2. = 'open' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN A2. = 'open' AND A2. = 'open' AND A1. = '0' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN A1. IN (1) AND A2. = 'open' AND A1. IN (1) AND A2. = 'open' AND A1. IN (1) AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN A2. = 'closed' AND A2. = 'closed' AND A1. BETWEEN '2021-09-27 22:00:00' AND '2021-09-28 21:59:59' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN A2. = 'open' AND A2. = 'open' AND A1. = '1' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN A1. IN (1) AND A2. = 'open' AND A1. IN (1) AND A2. = 'open' AND NOT A1. IN (1) AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN A2. = 'closed' AND A2. = 'closed' AND A1. BETWEEN '2021-09-26 22:00:00' AND '2021-09-27 21:59:59' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN A2. = 'open' AND A2. = 'open' AND A1. = '1' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN A1. IN (1) AND A2. = 'open' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN A2. = 'closed' AND A2. = 'closed' AND A1. BETWEEN '2021-09-26 22:00:00' AND '2021-10-03 21:59:59' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN A2. = 'closed' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN A2. = 'closed' AND A2. = 'closed' AND A1. BETWEEN '2021-08-31 22:00:00' AND '2021-09-30 21:59:59' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN A2. = 'closed' AND A2. = 'closed' AND A1. BETWEEN '2021-06-30 22:00:00' AND '2021-09-30 21:59:59' AND A3. = 'T' THEN A1. END) AS , COUNT(DISTINCT CASE WHEN A2. = 'closed' AND A2. = 'closed' AND A1. BETWEEN '2020-12-31 23:00:00' AND '2021-12-31 22:59:59' AND A3. = 'T' THEN A1. END) AS FROM A1 JOIN A2 ON (A1. = A2.) LEFT JOIN A3 ON (A3. = 'T' AND A1. = A3.) LEFT JOIN A4 ON (A3. = A4.) LEFT JOIN A5 ON (A4. = 'S' AND A4. = A5.) LEFT JOIN A6 ON (A1. = A6. AND A6. = 'C') LEFT JOIN A7 ON (A6. = A7.) LEFT JOIN A8 ON (A7. = 'S' AND A7. = A8.) LEFT JOIN B0 ON (A4. = 'D' AND A4. = B0.) LEFT JOIN B1 ON (A7. = 'D' AND A7. = B1.) LEFT JOIN B2 ON (A1. = B2.) LEFT JOIN B3 ON (B2. = B3.) JOIN B4 ON (B4. = 'T' AND A1. = B4.) LEFT JOIN B5 ON (B4. = B5.) LEFT JOIN B6 ON (B4. = B6.) LEFT JOIN B7 ON (B4. = B7.) LEFT JOIN B8 ON (B4. = B8.) LEFT JOIN C0 ON (B4. = C0.) LEFT JOIN C1 ON (B4. = C1.) LEFT JOIN C2 ON (B4. = C2.) WHERE ((A2. = 'open' AND (A1. = 1 OR A5. = 1 OR A6. = 'C' AND A8. = 1)) OR (A2. IN ('open', 'closed') AND (A1. IN (1, 3, 4, 5) OR B0. IN (1, 3, 4, 5))) OR A6. = 'C' AND B1. IN (1, 3, 4, 5))