Working wit Normalized Table 
Author Message
 Working wit 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



Mon, 08 Apr 2002 03:00:00 GMT  
 Working wit Normalized Table
One way, is to first use a query to filter only the client ID at hand.  Then
do a find on the recordset to locate the desired event code.  If it's found,
then you can store that value in a variable for later use in calculation,
which by the way, can easliy be done using the DateDiff function.
Obvioulsy, you'd have to trap for cases like, not fiding the desired event
code, or duplicate event codes for the same client (multiple visits?)

I'm not sure what you're doing really requires the use of an array.  After
all, you can do the same type things with a recordset.

HTH
C YA


Quote:
> 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



Mon, 08 Apr 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Working with Normalized Table

2. Normalizing a flat table w/VBA

3. Normalizing a table with VBA

4. Normalizing non-normal tables already containing data;OR changing columns into rows

5. Delete Table Field wit VBA code

6. Populating a DB-grid wit rows from large SQL server tables

7. Code to normalize a database

8. normalizing

9. Normalize String Spacing

10. Are there performance gains from normalizing data?

11. Normalized Data

12. Normalized Random Number Generator

 

 
Powered by phpBB® Forum Software