query-bbdf28814911ad19af342a7f3b44a3ca

rq turtle/ttl

: Q2 says 7,830,458,560. Quick & dirty query says 7,656,562,753.Ainali@Thanks, that helped me on the right track, this is what I wanted:

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT (sum(?pop) as ?population) ?earthpop (?population - ?earthpop AS ?diff)
WHERE 
{
  ?item wdt:P463 wd:Q1065. # ?item is a member of the United Nations
  ?item wdt:P1082 ?pop.    # has a truthy population statement
  filter not exists {?item wdt:P576 [] .} # has not been dissolved
  wd:Q2 wdt:P1082 ?earthpop .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} GROUP BY ?earthpop

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?diff") v3("?earthpop"):::projected v1("?item") v2("?pop"):::projected v4("?population"):::projected a1((" ")) c7(["bd:serviceParam"]):::iri c5(["wd:Q2"]):::iri c3(["wd:Q1065"]):::iri c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"wdt:P576"--> e0a1 e0v1("?item"):::projected e0a1((" ")):::projected end f0--EXISTS--> f0e0 f0 --> v1 f0 --> c1 f0 --> a1 v1 --"wdt:P576"--> a1 v1 --"wdt:P463"--> c3 v1 --"wdt:P1082"--> v2 c5 --"wdt:P1082"--> v3 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end bind2[/"sum(?pop)"/] v2 --o bind2 bind2 --as--o v4 bind3[/"?population - ?earthpop"/] v4 --o bind3 v3 --o bind3 bind3 --as--o v5