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

SQL

AخA
 
use arwiki_p;
select page_title, replace(cl_to, "مواليد_", "") as "تاريخ الولادة",
replace((select cl_to from categorylinks where page_id = cl_from and cl_to like "وفيات_%" limit 1), "وفيات_", "") as "تاريخ الوفاة",
concat("وفيات بعمر ",replace((select cl_to from categorylinks where page_id = cl_from and cl_to like "وفيات_%" limit 1), "وفيات_", "") - replace(cl_to, "مواليد_", "")) as "التصنيف المطلوب"
from page
inner join categorylinks on cl_from = page_id
where page_namespace = 0 and page_is_redirect = 0
and cl_to like "%مواليد%" 
and page_id not in (select cl_from from categorylinks where page_id = cl_from and cl_to like "وفيات_بعمر_%") 
and page_id in (select cl_from from categorylinks where page_id = cl_from and cl_to like "وفيات_%");
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...