houstonbill
Technical User
- Nov 6, 2006
- 92
I am struggling with a query and looking for a bit of help. Below is the SQL of my 1st query. What I am trying to do is create a 2nd query that will tell me how many cases were closed by [CSR Name] in 7 days. Date1 and status1 (I059)Should be when case comes into the department. Date2 and status2 (I082) Should be when it is assigned to [CSR Name]. In reviewing the data, I find that in some cases the 1st date and status is I082 rather than the normal I059 status. I need to measure the time from when it was in status I082 (Date1 or Date2)and when it was closed [Closed Dt] by the [CSR Name]. I can do everything but the expression which I think will be "IIF and Then".
FROM RespCdeLst RIGHT JOIN (tblLastUpdated LEFT JOIN tblDeskCodes ON tblLastUpdated.[Desk Cd] = tblDeskCodes.[Desk Code]) ON RespCdeLst.RespCde = tblLastUpdated.[Resp Cd]
GROUP BY RespCdeLst.RespMain, tblLastUpdated.[Closed Dt], tblDeskCodes.[CSR Name], tblLastUpdated.Date1, tblLastUpdated.Status1, tblLastUpdated.Date2, tblLastUpdated.Status2
HAVING (((tblLastUpdated.[Closed Dt]) Like "*2007*"));
FROM RespCdeLst RIGHT JOIN (tblLastUpdated LEFT JOIN tblDeskCodes ON tblLastUpdated.[Desk Cd] = tblDeskCodes.[Desk Code]) ON RespCdeLst.RespCde = tblLastUpdated.[Resp Cd]
GROUP BY RespCdeLst.RespMain, tblLastUpdated.[Closed Dt], tblDeskCodes.[CSR Name], tblLastUpdated.Date1, tblLastUpdated.Status1, tblLastUpdated.Date2, tblLastUpdated.Status2
HAVING (((tblLastUpdated.[Closed Dt]) Like "*2007*"));