Fork of Scrape OTRS from files in Files_with_PermissionOTRS_template_but_without_P6305_SDC_statement by Jarekt
This query is marked as a draft This query has been published by Jarekt.

SQL

AخA
 
use commonswiki_p;
SELECT count(page_id) AS num, 
    concat('"',REPLACE(el_to,'https://ticket.wikimedia.org/otrs/index.pl?Action=AgentTicketZoom&TicketNumber=',''),'"') AS OTRS,
    min(concat("File:",page_title))
FROM page
JOIN categorylinks c1 ON page_id=c1.cl_from AND c1.cl_to='Files_with_PermissionTicket_ID_different_from_SDC'
join templatelinks on page_id=tl_from and tl_namespace = 10  AND tl_title="PermissionTicket"
JOIN externallinks ON page_id=el_from AND el_to LIKE 'https://ticket.wikimedia.org/otrs/index.pl?Action=AgentTicketZoom&TicketNumber=%'
group by OTRS
order by num desc
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...