I an trying to retrieve the distinct records using the follow SQL Statement:
SELECT count (*) FROM(
SELECT DISTINCT pv1.docid, pv2.docid
FROM Frequency pv1
INNER JOIN Frequency pv2
ON pv1.docid = pv2.docid
AND pv1.term="transactions"
AND pv2.term="world")x;
The schema is:
CREATE TABLE Frequency (
docid VARCHAR(255),
term VARCHAR(255),
count int,
PRIMARY KEY(docid, term);
I know that there are 187 docs containing term world and 26 containing transactions.