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

SQL

x
 
USE fawiki_p;
#SELECT REPLACE(pg.page_title,'_',' ') page_title, REPLACE(rd.page_title,'_',' ') old_link, REPLACE(rd_title,'_',' ') new_link
SELECT REPLACE(pg.page_title,'_',' ') page_title, REPLACE(rd.page_title,'_',' ') old_link, REPLACE(rd_title,'_',' ') new_link, COUNT(rd.page_title)
FROM page AS rd JOIN redirect ON rd_from = rd.page_id JOIN pagelinks ON pl_title = rd.page_title JOIN page AS pg ON pl_from = pg.page_id
WHERE rd.page_namespace = 0
AND rd.page_is_redirect = 1 
AND rd.page_title LIKE "%(فیلم)"
AND rd_namespace = 0
AND rd_title LIKE "%(فیلم\_%"
AND MID(rd_title,1,LOCATE('(فیلم',rd_title)-2) = MID(rd.page_title,1,LOCATE('(فیلم',rd.page_title)-2)
AND pl_from_namespace = 0 
AND pl_namespace = 0
AND pg.page_namespace = 0
AND pg.page_is_redirect = 0
GROUP BY rd.page_title
ORDER BY COUNT(rd.page_title) 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...