B
BKE
I'm working with two tables - the primary table having one
record per patient. The foreign key table has multiple
records (lab work) for each patient. Some patients have
just 1-2 records in the lab table, some have 10-20-30+. We
need to analyze this data in SPSS (statistical software)
and I need to put all of a patient's lab records into one
row for this analysis.
Example:
Table looks like this (ID#, lab date, lab test, results)
#11, 10/15/2003, ALT, 1000
#11, 10/15/2003, Viral Load, 1000
#11, 11/4/2003, ALT, 2000
#11, 11/4/2003, Viral Load, 2000
#14, 10/31/2003, ALT, 1500
#14, 11/3/2002, Viral Load, 1600
I want a query to produce rows like these:
#11, 10/15/2003, ALT, 1000, 10/15/2003, Viral Load, 1000,
11/4/2003, ALT, 2000, 11/4/2003, Viral Load, 2000
#14, 10/31/2003, ALT, 1500, 11/3/2002, Viral Load, 1600
How would I go about doing this? Thanks.
Billie
record per patient. The foreign key table has multiple
records (lab work) for each patient. Some patients have
just 1-2 records in the lab table, some have 10-20-30+. We
need to analyze this data in SPSS (statistical software)
and I need to put all of a patient's lab records into one
row for this analysis.
Example:
Table looks like this (ID#, lab date, lab test, results)
#11, 10/15/2003, ALT, 1000
#11, 10/15/2003, Viral Load, 1000
#11, 11/4/2003, ALT, 2000
#11, 11/4/2003, Viral Load, 2000
#14, 10/31/2003, ALT, 1500
#14, 11/3/2002, Viral Load, 1600
I want a query to produce rows like these:
#11, 10/15/2003, ALT, 1000, 10/15/2003, Viral Load, 1000,
11/4/2003, ALT, 2000, 11/4/2003, Viral Load, 2000
#14, 10/31/2003, ALT, 1500, 11/3/2002, Viral Load, 1600
How would I go about doing this? Thanks.
Billie