select count(*) from (select distinct(docid) from frequency where term ='transactions' and count>0 intersect select distinct(docid) from frequency where term='world' and count>0 ) ;