|
Subject:
|
Query Help - Display numbers from two Months
|
|
Posted By:
|
rkellogg
|
Post Date:
|
9/4/2006 11:30:01 AM
|
I am trying to make a very simple report. I want to display billable hours for each Rep for both this month and last month on this report. I have two queries (not sure if I can do it on one Query or not) One query has the criteria month(date()) and the other one has Month(Date())-1.
I guess there are two questions: 1. Can I get both values from one Query? 2. How can I display both numbers on one report.
Thanks for the help.
Here is the SQL View of my Queries.
SELECT DISTINCTROW Rep.FirstName, Sum(WorkorderTime.WorkOrderTime) AS [Sum Of WorkOrderTime] FROM Rep RIGHT JOIN WorkorderTime ON Rep.RepID = WorkorderTime.RepId GROUP BY Rep.FirstName, Month([WorkOrderDate]) HAVING (((Month([WorkOrderDate]))=Month(Date())));
SELECT DISTINCTROW Rep.FirstName, Sum(WorkorderTime.WorkOrderTime) AS [Sum Of WorkOrderTime] FROM Rep RIGHT JOIN WorkorderTime ON Rep.RepID = WorkorderTime.RepId GROUP BY Rep.FirstName, Month([WorkOrderDate]) HAVING (((Month([WorkOrderDate]))=Month(Date())-1));
|
|
Reply By:
|
mmcdonal
|
Reply Date:
|
9/5/2006 6:53:23 AM
|
Can't you do this:
HAVING (((Month([WorkOrderDate]))=Month(Date())) OR ((Month([WorkOrderDate]))=Month(Date()));
mmcdonal
|
|
Reply By:
|
sola
|
Reply Date:
|
9/27/2006 8:51:34 AM
|
try this
HAVING (((Month([WorkOrderDate]))=Month(Date())) and ((Month([WorkOrderDate]))=Month(Date()));
|