Fork of wf by Mr. Ibrahem
This query is marked as a draft This query has been published by Mr. Ibrahem.

SQL

x
 
USE wikidatawiki_p;
SELECT * #CONCAT('Q', term_entity_id, '') AS id, term_text
from wb_terms , pagelinks, wb_items_per_site
        /*
    LEFT JOIN wb_items_per_site
        ON term_entity_id = ips_item_id AND ips_site_id = 'arwiki' 
     JOIN pagelinks
        ON pl_from = term_entity_id AND pl_namespace = 120 AND pl_title = 'P21'
    LEFT JOIN pagelinks
        ON pl_from = term_entity_id AND pl_namespace = 0 AND pl_title = 'Q5'
*/
WHERE term_entity_type = 'item'
and term_entity_id = ips_item_id AND ips_site_id = 'arwiki' 
and pl_from = term_entity_id AND pl_namespace = 120 AND pl_title = 'P21'
#and term_entity_id in (SELECT pl_from FROM pagelinks where term_entity_id = pl_from and pl_namespace = 0 and pl_title = "Q5")
                       
               #        term_entity_id AND pl_namespace = 0 AND pl_title = 'Q5'
AND ips_site_page IS NULL
AND term_language = 'ar'  AND term_type = 'label'
#ORDER BY term_entity_id
GROUP BY term_entity_id
limit 10
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...