Problem with Count query (1 Viewer)

BennyLinton

Registered User.
Local time
Today, 14:52
Joined
Feb 21, 2014
Messages
263
Thanks in advance for any clues on making this query work. I am trying to count the number of applicants in each of 3 categories for a date range so that my datasheet view looks something like this:

Applications Education
_________ _______
27 Phd
134 Masters
259 BA/BS

Here's what I have so far:

SELECT Count(*) AS Applications, dbo_People.education
FROM (dbo_certs INNER JOIN dbo_People ON dbo_certs.peopleId = dbo_People.peopleId)
INNER JOIN dbo_lookupEducation ON dbo_People.Educationid = dbo_lookupEducation.educationId
WHERE (((dbo_certs.ApplicationDate) Between [Beginning Application Date:] And [Ending Application Date:]))
GROUP BY dbo_People.education;
 
Last edited:

vba_php

Forum Troll
Local time
Today, 16:52
Joined
Oct 6, 2019
Messages
2,880
Benny,

You might have it more complicated than necessary, but I can't say for sure. Try changing this:
Code:
SELECT Count(*) AS Applications, dbo_People.education
 FROM (dbo_certs INNER JOIN dbo_People ON dbo_certs.peopleId = dbo_People.peopleId) 

 INNER JOIN dbo_lookupEducation ON dbo_People.Educationid = dbo_lookupEducation.educationId
 WHERE (((dbo_certs.ApplicationDate) Between [Beginning Application Date:] And [Ending Application Date:]))
 GROUP BY dbo_People.education;
to this:
Code:
SELECT Count(*) AS Applications, dbo_People.education
 FROM (dbo_certs INNER JOIN dbo_People ON dbo_certs.peopleId = dbo_People.peopleId) 

 WHERE (((dbo_certs.ApplicationDate) Between [Beginning Application Date:] And [Ending Application Date:]))
GROUP BY dbo_People.education;
where you only have 2 tables involved in the process:

  1. dbo_certs
  2. dbo_people
just my take on how to possibly simplify it.
 

Users who are viewing this thread

Top Bottom