drop table occurs; create table occurs (pred "integer", sub "integer", ob "integer", occurs "integer"); insert into occurs select predicate,subject,object,count(*) from triples group by predicate, subject, object; SELECT DISTINCT occurs, resources.value FROM occurs, resources WHERE resources.keyhash=occurs.pred AND resources.value LIKE 'http://www.wapforum.org/profiles/UAPROF/ccppschema-20010430#%' AND occurs > 1 ORDER BY occurs DESC; -- select * from triples where predicate='1547507681' AND subject='-1068989238' and object='1145937192'; -- select * from occurs where pred='1547507681' AND sub='-1068989238' and ob='1145937192';