
Working with Normalized Table
I have a table set up as follows
ID Event Date
1 20 5/01
1 21 5/12
1 30 7/11
2 99 2/6
3 99 3/4
3 20 4/18
4 21 6/21
4 20 7/1
4 30 7/30
The events represent admission (99), hospitalization (20), return from the
hospital (21) and discharge (30). What I need to do is to calculate the
interval between hospitalization and return from the hospital. In all
instances a return date is later than the hospitalization date but some
clients who are hospitalized are discharged prior to returning (handling
this exception is not a problem for me).
One way to do this is to un-normalize the data such that events are arrayed
across columns of the same record but I have to believe there is a more
elegant solution. I can probably handle the coding once I figure out how to
make row to row comparisons. It seems to me that multiple rows of data for
each client ID have to somehow get read into an array but I don't know how
to do this. Can anyone help?
Eric Graig