Problems with Count query

  • Thread starter Thread starter Lee
  • Start date Start date
L

Lee

I am trying to create a query where I can group all the
employees in a file by the medical option selected and the
type of family coverage selected, limited to employees who
earn $50K or greater in salary, and then count the number
of employees in each grouping. I've done exactly the same
query for employees earning less than $50K and it worked
perfectly. I know for certain that there are definitely
employees in the file earning greater than $50K, but when
I run the query it returns no records.

Here's the query:

SELECT qry2003.[Med Option], qry2003.[Med Coverage Tier],
Count(qry2003.[Annual Salary]) AS [CountOfAnnual Salary]
FROM qry2003
GROUP BY qry2003.[Med Option], qry2003.[Med Coverage Tier]
HAVING (((Count(qry2003.[Annual Salary]))>=50000));

What am I doing wrong?
 
Looks like maybe you have a copy/paste error. I don't
think you want count in your having statement.

DonC
 
You might try replacing your HAVING clause with the following WHERE clause:

WHERE qry2003.[Annual Salary]>=50000

If you used a similar query for the employees earning less than $50K, the
results would be not what you were expecting, in that they would have
actually included employees earning $50K and more as well. For the
employees earning less than $50K, you might replace your HAVING clause with
the following WHERE clause:

WHERE qry2003.[Annual Salary]<50000
 
Back
Top