|
Subject:
|
Linking dates
|
|
Posted By:
|
A17560127
|
Post Date:
|
9/30/2005 3:44:58 AM
|
I have a table 1 of 10000 records with the following colums: Prak (identification practice), DNr (identification patient), Sex, YearOfBirth, DateDiagnose and a table 2 of 135000 different records with: Prak (identification practice), DNr (identification patient), Sex, YearOfBirth
Now I want to ad the date of diagnoses of t1 to the patients in t2 with the same sex and YearOfBirth
The problem is that if I link sex and YearOfBirth the tables multiply.
|
|
Reply By:
|
robprell
|
Reply Date:
|
9/30/2005 11:44:06 AM
|
This is not enough information. You need to tell us what fields are unique if any. I think what you need to do is link off of a combination of [Prak (identification practice) and DNr (identification patient)]. Sex and YearofBirth is not unique by patient so you can't link off them without risking a cartesian product(bad join). You need to find unique data between the tables to link off of, like an ID field of some sort.
|
|
Reply By:
|
A17560127
|
Reply Date:
|
10/2/2005 5:08:44 AM
|
Table 1: Prak DosNr Gesl GebJr DatDiagn M0101 7 F 1923 13/12/1997 M0101 25 F 1923 16/07/1995 M0101 123 F 1923 1/11/2003 M0102 15 M 1923 15/7/2000
Table2 Prak DosNr Gesl GebJr M0101 223 F 1923 M0101 1013 F 1923
I want to give the patients of table 2 give ad random a date of diagnosis of a patient with a patient of the same sex and year of birth from table 1. Patients of the same sex and year of birth are 'matched' for statisrtical reasons. It is possible to give for example the MIN or MAX date to patients with the same sex and year of birth, but the different dates had to been seen in table 2.
|
|
Reply By:
|
robprell
|
Reply Date:
|
10/3/2005 10:55:14 AM
|
I don't think you can link off a "min" or "max" directly in SQL but you could select min or max into a temp table and link off that if I understand you right.
|
|
Reply By:
|
A17560127
|
Reply Date:
|
10/3/2005 1:10:13 PM
|
That's possible, but then all the patients in table 2 with the same sex and year of birth have the same date of diagnosis. I try to give them the different dates of table 1. I think it's not possible by a direct link.
|