Fork of مقاله‌های تغییرمسیری که بحثشان وجود دارد ولی تغییرمسیر نیست by Dalba
This query is marked as a draft This query has been published by Saeidpourbabak.

SQL

x
 
USE fawiki_p;
SELECT REPLACE(concat('بحث:',t.page_title),'_',' ')#, t.page_len
FROM page AS t
WHERE t.page_namespace  = 1
AND t.page_is_redirect = 0
AND t.page_len > 0
AND t.page_title NOT LIKE "قنات_%"
AND EXISTS (
  SELECT null
  FROM page AS p
  WHERE p.page_namespace = 0
  AND p.page_title = t.page_title
  AND p.page_is_redirect = 1
)
AND t.page_title NOT IN (
  SELECT pl_title
  FROM pagelinks JOIN categorylinks ON cl_from = pl_from
  WHERE pl_from_namespace = 1
  AND pl_namespace = 1
  AND cl_to = 'صفحههای_دارای_جعبه_بحثشده_در_جای_دیگر'
  AND pl_title = t.page_title
)
/*
AND t.page_id IN (
  SELECT page_id
  FROM page JOIN templatelinks ON page_id = tl_from
  WHERE tl_from_namespace = 1
  AND tl_title = 'پیشینه_حذف'
  AND tl_namespace = 10
#  AND page_len < 500
  )*/
AND t.page_id NOT IN (
  SELECT page_id
  FROM page JOIN templatelinks ON page_id = tl_from
  WHERE tl_from_namespace = 1
  AND (
    tl_title = 'ادغام_شد_در'
    OR tl_title = 'ادغام_شد_از')
  AND tl_namespace = 10
#  AND page_len < 500
  )
/*
AND t.page_id IN (
  SELECT page_id
  FROM page JOIN pagelinks ON page_id = pl_from
  WHERE pl_from_namespace = 1
  AND pl_title = 'Amirobot'
  AND pl_namespace = 2
#  AND page_len < 500
  )
*/
ORDER BY t.page_len 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.

Checking query status...