Multiple results with Count

  • Thread starter Syed Zeeshan Haider
  • Start date
S

Syed Zeeshan Haider

Hello Everybody,
In Access 2003, I am trying to get multiple results in a query using Count
with the same column and table as my source of data. So far I have been
unsuccessful in bringing two results of Count onto a same query.

For example: I have a list of amounts paid to different employees in a
column. I want to count the rows base on two different criteria (i) rows
with amounts more than $1000 each and (ii) rows with amounts less than $500.
I want to get the results of these two criteria in same query but in two
different fields with distinct names.

What would be the structure of SQL for this kind of calculation? Any ideas
how to work this out?
 
A

Allen Browne

Type an expression like this in the Field row:
Over1000: IIf([Amount] > 1000, 1, 0)

In the Total row under this field, choose Sum.
 
S

Syed Zeeshan Haider

Fantastic! Thank you!


Allen Browne said:
Type an expression like this in the Field row:
Over1000: IIf([Amount] > 1000, 1, 0)

In the Total row under this field, choose Sum.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Syed Zeeshan Haider said:
Hello Everybody,
In Access 2003, I am trying to get multiple results in a query using
Count with the same column and table as my source of data. So far I have
been unsuccessful in bringing two results of Count onto a same query.

For example: I have a list of amounts paid to different employees in a
column. I want to count the rows base on two different criteria (i) rows
with amounts more than $1000 each and (ii) rows with amounts less than
$500. I want to get the results of these two criteria in same query but
in two different fields with distinct names.

What would be the structure of SQL for this kind of calculation? Any
ideas how to work this out?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top