How to query by date using individual columns for Months?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to create a query structures the following date:

[problem] [problem_sub_type] [description] [date] [total]
problem1 subtype1 blahblah jan 5
problem2 subtype1 blahblah jan 12
problem1 subtype1 blahblah feb 7
problem2 subtype1 blahblah feb 12

I am grouping by problem, problem_sub_type, and description.
I want to have columns in the query for Jan, Feb, Mar, etc. with the totals
by month for each of the unique values that occur when querying using "Group
By"

so the query ends up as:
[problem] [problem_sub_type] [description] [jan] [feb]
problem1 subtype1 blahblah 5 7
problem2 subtype1 blahblah 12 12

I can Sum the totals, but haven't been able to sum, using date=jan as a
criteria. I keep getting an error:

You tried to execute a query that does not include the specified expression
[Date] = Jan as part of an aggregate function.

Also, I have a dataset where a specific problem may not be present for a
given month. How would that display in this query? Can I get a 0 to show
for months where a problem doesn't occur? So jan might show 5, but Feb is 0,
Mar is 12, and so forth.

Thanks for any advice and pointing me in the right direction.

-Don
 
Back
Top