belovedcej
Programmer
I've seen a few threads on this, but not exactly like what I need.
Here's a brief description:
I am creating a case statistics report.
Desired output:
TotalCases, (grouped by) StatusDesc
Parameter:
final "status" occurs between beginDate and EndDate
I tried starting with something like this:
But the problem with this is that I need the eventID in order to find out what the status is.
I can't use the max eventID because it is possible to enter things out of order.
also, I will need to make a determination of which status will count if two events occur in the same day.
So I can't even get to the counting yet.
Any thoughts please?
Thank you!
Here's a brief description:
Code:
Table1 columns: EventDate, EventId, CaseID, typeID
Table2 columns: typeID, statusID
Table3 columns: statusID, statusDesc
Desired output:
TotalCases, (grouped by) StatusDesc
Parameter:
final "status" occurs between beginDate and EndDate
I tried starting with something like this:
Code:
select max(eventDate), caseID
from table1
inner join table2 on table2.typeID = table1.typeID
and statusID = 0
where table1.eventDate between @startDate and @endDate
group by caseID
But the problem with this is that I need the eventID in order to find out what the status is.
I can't use the max eventID because it is possible to enter things out of order.
also, I will need to make a determination of which status will count if two events occur in the same day.
So I can't even get to the counting yet.
Any thoughts please?
Thank you!