count from more than one query (1 Viewer)

supmktg

Registered User.
Local time
Today, 11:16
Joined
Mar 25, 2002
Messages
360
I am trying to get the count of records from several queries into one query. This is the SQL from each of them:

SELECT Count(Q_Auth_Family_cnt.SSN) AS FamAuthCnt
FROM Q_Auth_Family_cnt;

SELECT Count(Q_Auth_MD_cnt.SSN) AS MDAuthCnt
FROM Q_Auth_MD_cnt;

SELECT Count(qryAuthToUpload.DSYID) AS PAAuthCnt
FROM qryAuthToUpload;

When I combine them into :

SELECT Count(Q_Auth_Family_cnt.SSN) AS FamAuthCnt
FROM Q_Auth_Family_cnt, Count(Q_Auth_MD_cnt.SSN) AS MDAuthCnt
FROM Q_Auth_MD_cnt, Count(qryAuthToUpload.DSYID) AS PAAuthCnt
FROM qryAuthToUpload;

I get a 'syntax error in from clause'.

Is there a way to do this from three different queries with no relationship?

Thanks,

Sup
 

mik

Lost in a VBA Jungle
Local time
Tomorrow, 03:16
Joined
Nov 16, 2004
Messages
22
Union Solution

Try this

SELECT Count(Q_Auth_Family_cnt.SSN) AS record_count, "FamAuthCnt" as source
FROM Q_Auth_Family_cnt
Group by "FamAuthCnt"
Union
SELECT Count(Q_Auth_MD_cnt.SSN) AS record_count, "MDAuthCnt " as source
FROM Q_Auth_MD_cnt
Group by "MDAuthCnt "
Union
SELECT Count(qryAuthToUpload.DSYID) AS record_count, "PAAuthCnt " as source
FROM qryAuthToUpload
Group by "PAAuthCnt ";
 
Last edited:

supmktg

Registered User.
Local time
Today, 11:16
Joined
Mar 25, 2002
Messages
360
Thanks!

I've never used a union query before. It gives me just the info I want, in one place.

Sup
 

Users who are viewing this thread

Top Bottom