Link to home
Start Free TrialLog in
Avatar of Michael Johnston
Michael Johnston

asked on

access query with one or more criteria

I have a data set of
column 1 = activity ID
column 2 = accepted/rejected (value is either "R" or  "A")
column 3 = accept (value is either "A" or left blank)
column 4 = sum of hours (numerical value of hours)
what I need is to generate a sum with one or more criteria for the activity ID
sum 1 = sum of hours where column 2 = "R"
sum 2 = sum of hours where column 2 = "R" and column 3 = "A"
sum 3 = sum of hours where column 2 = "R" and column 3 = blank or null
Avatar of Nitin Sontakke
Nitin Sontakke
Flag of India image

It's been while since I worked on MS-Access, but is something like following possible?

select activityId, sum(iif(column2 = "R", column4, 0)) sum1
from table_name
 

Open in new window



If yes, you can derive formulas on similar lines. And add group by of course!
ASKER CERTIFIED SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial