I want to count the result based from the select query, but this query doesn't work. A little help is appreciated.
Code:
SELECT Count(*) AS Total FROM
(
SELECT tblPoolReference.EntryDocID
FROM tblPoolReference
INNER JOIN
(
SELECT Distinct Correspondence_ID, Reference_No FROM tblPoolCorrespondence
WHERE (EntryDocID=2) OR (Correspondence_ID=2) OR (CGroupID = 1)
) AS tblCorr
ON (tblPoolReference.EntryDocID = tblCorr.Correspondence_ID)
AND (tblPoolReference.EntryDocID <> 1
)
WHERE EntryDocID=2 Or Correspondence_ID=1 Or CGroupID=1)