E
EricK
Suppose I have a table with fields as follows:
Case_id Date_in Date_out Case_type
Case_id is primary key: 1,2,3 etc
Date_in was the date the case came in. This is always present.
Date_out is the date the case was completed. This will be blank if the case
has not yet been completed.
Case_type will be one of type1, type2, type3 etc
Given two dates, date1 and date2, which need to be user specified each time
this is run, I want to produce output which looks like this:
BF In 0-1 2-3 4-5 >5 CF
type1
type2 # of cases
type3
i.e. each row relates to a particular case type.
"BF", Brought Forward, is the number of cases of that type which had been
received before date1 but had not been returned by then (so date_in will be
<date1 and date_out will be Null or >=date1).
"In" is the number of cases which came in between date1 and date2
"0-1" is the number of cases which went out in between date1 and date 2 and
took either 0 or 1 days.
"2-3" is the number of cases which went out between date1 and date2 and took
2 or 3 days.
Similarly for "4-5" and ">5". Note for all of these it doesn't matter when
the case came in, only that it went out between the two dates
"CF", Carry Forward, is the number of cases which had not been returned by
date2 (so date_out will be Null or will be greater than date2).
How do I go about doing this?
Thanks for any help,
Eric
Case_id Date_in Date_out Case_type
Case_id is primary key: 1,2,3 etc
Date_in was the date the case came in. This is always present.
Date_out is the date the case was completed. This will be blank if the case
has not yet been completed.
Case_type will be one of type1, type2, type3 etc
Given two dates, date1 and date2, which need to be user specified each time
this is run, I want to produce output which looks like this:
BF In 0-1 2-3 4-5 >5 CF
type1
type2 # of cases
type3
i.e. each row relates to a particular case type.
"BF", Brought Forward, is the number of cases of that type which had been
received before date1 but had not been returned by then (so date_in will be
<date1 and date_out will be Null or >=date1).
"In" is the number of cases which came in between date1 and date2
"0-1" is the number of cases which went out in between date1 and date 2 and
took either 0 or 1 days.
"2-3" is the number of cases which went out between date1 and date2 and took
2 or 3 days.
Similarly for "4-5" and ">5". Note for all of these it doesn't matter when
the case came in, only that it went out between the two dates
"CF", Carry Forward, is the number of cases which had not been returned by
date2 (so date_out will be Null or will be greater than date2).
How do I go about doing this?
Thanks for any help,
Eric