Fork of
Pages by last edit time in cat tree 1
by Cryptic
This query is marked as a draft
This query has been published
by Cryptic.
SQL
x
SET @basecat = 'Chefs';
SET max_recursive_iterations = 4;
SET @basecat = REPLACE(@basecat, ' ', '_');
WITH RECURSIVE deepcat (subcat) AS
(
SELECT @basecat
UNION DISTINCT
SELECT page_title
FROM categorylinks
JOIN page ON page_id = cl_from
JOIN deepcat ON cl_to = subcat
WHERE page_namespace = 14
),
ns(ns_n, ns_s) AS (VALUES (-2, 'Media:'), (-1, 'Special:'), (0, ''), (1, 'Talk:'), (2, 'User:'), (3, 'User talk:'), (4,
'Wikipedia:'), (5, 'Wikipedia talk:'), (6, ':File:'), (7, 'File talk:'), (8, 'MediaWiki:'), (9, 'MediaWiki talk:'), (10, 'Template:'),
(11, 'Template talk:'), (12, 'Help:'), (13, 'Help talk:'), (14, ':Category:'), (15, 'Category talk:'), (100, 'Portal:'), (101,
'Portal talk:'), (118, 'Draft:'), (119, 'Draft talk:'), (126, 'MOS:'), (127, 'MOS talk:'), (710, 'TimedText:'), (711, 'TimedText talk:'),
(828, 'Module:'), (829, 'Module talk:'))
SELECT DISTINCT REPLACE(page_title, '_', ' ') AS title,
CAST(rev_timestamp AS DATETIME) AS 'last edit timestamp'
FROM page
JOIN categorylinks ON cl_from = page_id
JOIN deepcat ON cl_to = subcat
JOIN revision ON rev_id = page_latest
WHERE page_namespace = 0
AND page_is_redirect = 0
ORDER BY rev_timestamp 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.