This query is marked as a draft This query has been published by Pppery.

SQL

AخA
 
SELECT REGEXP_REPLACE(comment_text,
                      '^(?:\\[*(?:WP:)?(?:CSD)?(?:\\|CSD)?[]#: ]*)([A-Z][0-9]+)\\b(?:\\|\\1\\b)?(?!.*?(CSD|\\b[GARFICUPTX][0-9]+\\b)).*',
                      '\\1') AS csdcode,
       COUNT(*)
FROM logging_userindex
JOIN actor_logging ON actor_id = log_actor
JOIN comment_logging ON comment_id = log_comment_id
WHERE actor_name = 'Plastikspork'
  AND log_type = 'delete'
  AND log_action = 'delete'
  AND (comment_text LIKE '%CSD%'
       OR comment_text REGEXP '\\b[GARFICUPTX][0-9]+\\b')
GROUP BY csdcode
ORDER BY CASE WHEN (csdcode REGEXP '^[A-Z][0-9]+$') THEN CONCAT(' ', csdcode) ELSE csdcode END ASC;
By running queries you agree to the Cloud Services Terms of Use and you irrevocably agree to release your SQL under CC0 License.
All SQL code is licensed under CC0 License.

Checking query status...