SQL
x
SELECT
t.page_title AS template_title,
COUNT(*) AS usage_count
FROM page AS t
JOIN templatelinks AS l
ON l.tl_target_id = t.page_id
JOIN page AS p
ON p.page_id = l.tl_from
WHERE t.page_namespace = 10
GROUP BY t.page_id, t.page_title
HAVING
-- Šablon se koristi tačno jednom (jedan transkludirajući zapis)
COUNT(*) = 1
-- i ta jedina stranica koja ga koristi mora biti on sam
AND MIN(p.page_id) = t.page_id
ORDER BY t.page_title;
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.