This query is marked as a draft This query has been published by IKhitron.

SQL

x
 
set @en = "Mayors of places in the United_States";
set @he = "ראשי ערים בארצות הברית";
use enwiki_p;
set @s = replace(@en, " ", "_");
set @t = replace(@he, " ", "_");
select ll_title as "שם" from page inner join langlinks
on page_namespace = 0
and exists
(select * from categorylinks
 where cl_from = page_id
 and (cl_to = @s
      or exists
      (select * from page as p1
       where p1.page_title = cl_to
       and p1.page_namespace = 14
       and exists
       (select * from categorylinks as c1
        where c1.cl_from = p1.page_id
        and (c1.cl_to = @s
             or exists
             (select * from page as p2
              where p2.page_title = c1.cl_to
              and p2.page_namespace = 14
              and exists
              (select * from categorylinks as c2
               where c2.cl_from = p2.page_id
               and c2.cl_to = @s)))))))
and page_id = ll_from
and ll_lang = "he"
and exists
(select * from hewiki_p.page as p3
 where p3.page_namespace = 0
 and p3.page_title = replace(ll_title, " ", "_")
 and not exists
 (select * from hewiki_p.categorylinks as c3
  where c3.cl_from = p3.page_id
  and c3.cl_to = @t))
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...