Fork of mr.wiki templates on images by MGA73
This query is marked as a draft This query has been published by MGA73.

SQL

AخA
 
#USE mrwiki_p;
#Works!!! SELECT CONCAT("File:", page_title), GROUP_CONCAT(lt_title ORDER BY lt_title SEPARATOR ', ')
#SELECT lt_title, CONCAT("File:", page_title)#, GROUP_CONCAT(lt_title ORDER BY lt_title SEPARATOR ', ')
#SELECT lt_title, GROUP_CONCAT(page_title ORDER BY page_title SEPARATOR ', ')
SELECT lt_title, page_title
#SELECT CONCAT("# [[:File:", img_name, "]]") AS file, actor_name #, GROUP_CONCAT(c.cl_from SEPARATOR ' ¤¤¤ ')
#SELECT CONCAT("File:", page_title), lt_title
 FROM image
JOIN page
 ON page_namespace = 6
AND page_title = img_name
JOIN actor_image ON img_actor = actor_id
JOIN categorylinks
 ON cl_from = page_id
AND cl_type = "file"
#AND cl_to = "No_license" # ENTER THE CATEGORY HERE
AND page_is_redirect=0 
##AND NOT EXISTS(
#SELECT * FROM categorylinks 
#WHERE page_id=cl_from 
#AND (#cl_to LIKE 'Imagini_Creative_Commons%' 
#cl_to= "All_free_media" #free files
#  OR cl_to= "All_non-free_media" #non-Free files (FOP)
#  OR cl_to= "CC-BY-SA-4.0-disputed"
#  OR cl_to= "Files_with_no_license" 
#  OR cl_to= "All_free_in_US_media"
##      ))
#FROM image 
#JOIN page 
#ON page_namespace=6 
#AND page_title = img_name
#AND page_is_redirect=0 
#WHERE
#   cl_to = "Japan_map"
#    AND tl_title IN (
#      SELECT page_title
#      FROM page
#      JOIN categorylinks ON cl_from = page_id
  #    WHERE cl_to = "画像の著作権表示テンプレート"
 #   )
# AND NOT EXISTS(
#SELECT * FROM categorylinks 
#WHERE page_id=cl_from 
#AND (cl_to="All_free_media"
#OR cl_to= "Non-free_media"
#    ))
LEFT JOIN templatelinks ON tl_from = page_id
#JOIN categorylinks ON cl_from = page_id
LEFT JOIN linktarget ON tl_target_id = lt_id
#GROUP BY page_title
#ORDER BY page_title
#GROUP BY img_name ASC
#GROUP BY lt_title ASC
ORDER BY lt_title ASC
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...