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

SQL

AخA
 
use lvwiki_p;
SELECT #*
page_title, "P625", concat('@',gt_lat,'/',gt_lon), "S143", "Q728945"
#  page_title, gt_lat, gt_lon, gt_type, cl_to
FROM page
JOIN geo_tags ON gt_page_id = page_id
JOIN categorylinks ON cl_from = page_id
WHERE cl_to = "Koordinātas,_kas_nav_Vikidatos" and (exists (SELECT *
                                    FROM  categorylinks cl1 where cl1.cl_from = page_id
                                    and cl1.cl_to = "Latvijas_ciemi")
                                                    or
                                    
                                  page_id in (select tl.tl_from from templatelinks tl
                                where tl.tl_title in ("Upes_infokaste","Ezera_infokaste") and tl_namespace=10 and tl.tl_from_namespace=0))
                        
AND gt_globe = 'earth' and gt_primary=1
AND page_namespace = 0
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...