Count results from SELECT query (1 Viewer)

daryll

Registered User.
Local time
Today, 03:54
Joined
Jan 2, 2018
Messages
49
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)
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 18:54
Joined
May 7, 2009
Messages
19,175
you have filter on the sub query: Correspondence_ID=2
while on tblPoolReference, your filter is Correspondence_ID = 1.
so i guess you have 0 count.
 

daryll

Registered User.
Local time
Today, 03:54
Joined
Jan 2, 2018
Messages
49
Thanks Mr. Arnel, I got it working
 

Users who are viewing this thread

Top Bottom