SQL
x
use hewiki_p;
select pl_count as 'מספר הקישורים', pl_title as 'שם הערך' from
(select count(*) as pl_count, pl_title from pagelinks as pl1
where pl1.pl_from_namespace = 0
and pl1.pl_namespace = 0
and not exists
(select * from page
where pl1.pl_title = page_title
and page_namespace = 0)
and not exists
(select * from templatelinks
where pl1.pl_from = tl_from
and tl_from_namespace = 0
and tl_namespace = 10
and exists
(select * from page
where tl_title = page_title
and page_namespace = 10
and exists
(select * from pagelinks as pl2
where page_id = pl2.pl_from
and pl2.pl_from_namespace = 10
and pl2.pl_namespace = 0
and pl2.pl_title = pl1.pl_title)))
group by pl1.pl_title) as t
order by 'מספר הקישורים' 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.