SQL
AخA
SELECT REPLACE(lt_title, '_', ' ') AS "Vorlage", CONCAT('[[Spezial:Linkliste/Vorlage:', REPLACE(lt_title, '_', ' '), ']]') AS Linkliste
FROM linktarget, page
WHERE page_is_redirect = 0 # keine Weiterleitungen
AND lt_namespace = 10
AND page_title = lt_title
AND page_namespace = lt_namespace
# Nur von einem Benutzer eingebunden (354 Treffer)
AND (SELECT COUNT(DISTINCT SUBSTRING_INDEX(page_title, '/', 1))
FROM templatelinks AS t1, page AS p1
WHERE t1.tl_from_namespace = 2
AND t1.tl_target_id = lt_id
AND p1.page_id = t1.tl_from
) = 1
/* Alternativ zu oben: Von einem oder mehreren Benutzern eingebunden (404 Treffer)
AND EXISTS (SELECT 1
FROM templatelinks AS t1
WHERE t1.tl_from_namespace = 2
AND t1.tl_target_id = lt_id
)
*/
# In keinem Artikel im ANR verwendet
AND NOT EXISTS (SELECT 1
FROM templatelinks AS t2
WHERE t2.tl_from_namespace != 2
AND t2.tl_target_id = lt_id
)
# Babel-Kram ausnehmen
AND NOT EXISTS (SELECT 1
FROM categorylinks
WHERE cl_from = page_id
AND cl_to IN ('Vorlage:Babel-Sprache', 'Vorlage:Babel-Wikipedia')
)
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.