Go Back   Access World Forums > Microsoft Access Discussion > Queries

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 02-13-2018, 04:23 AM   #1
daryll
Newly Registered User
 
Join Date: Jan 2018
Posts: 28
Thanks: 12
Thanked 1 Time in 1 Post
daryll is on a distinguished road
Count results from SELECT query

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)

daryll is offline   Reply With Quote
Old 02-13-2018, 04:27 AM   #2
arnelgp
Registered User
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 6,695
Thanks: 55
Thanked 2,125 Times in 2,036 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Count results from SELECT query

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.
__________________
"Never stop learning, because life never stops teaching"
arnelgp is online now   Reply With Quote
The Following User Says Thank You to arnelgp For This Useful Post:
daryll (02-13-2018)
Old 02-13-2018, 05:01 AM   #3
daryll
Newly Registered User
 
Join Date: Jan 2018
Posts: 28
Thanks: 12
Thanked 1 Time in 1 Post
daryll is on a distinguished road
Re: Count results from SELECT query

Thanks Mr. Arnel, I got it working

daryll is offline   Reply With Quote
Reply

Tags
msaccess2013 , sql

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Select query to gather results of other select queries PRTP Queries 3 05-11-2014 08:57 PM
Update a query based on results from another query using count function DrPat Queries 3 04-03-2013 09:57 AM
Count based on query results? goldriverdancer Queries 1 01-13-2010 07:33 PM
Count results from a query Clintimania Reports 3 04-17-2009 07:27 AM
Query with no results (Zero Count) gold007eye Queries 2 06-27-2006 04:38 AM




All times are GMT -8. The time now is 12:19 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World