Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 30th, 2005, 03:44 AM
Registered User
 
Join Date: Apr 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Linking dates

I have a table 1 of 10000 records with the following colums:
Prak (identification practice), DNr (identification patient), ************, YearOfBirth, DateDiagnose
and a table 2 of 135000 different records with:
Prak (identification practice), DNr (identification patient), ************, YearOfBirth

Now I want to ad the date of diagnoses of t1 to the patients in t2 with the same ************ and YearOfBirth

The problem is that if I link ************ and YearOfBirth the tables multiply.

 
Old September 30th, 2005, 11:44 AM
Friend of Wrox
 
Join Date: Aug 2004
Location: Orange County, CA, USA.
Posts: 385
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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)]. ************ 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.

 
Old October 2nd, 2005, 05:08 AM
Registered User
 
Join Date: Apr 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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 ************ and year of birth from table 1.
Patients of the same ************ 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 ************ and year of birth, but the different dates had to been seen in table 2.

 
Old October 3rd, 2005, 10:55 AM
Friend of Wrox
 
Join Date: Aug 2004
Location: Orange County, CA, USA.
Posts: 385
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

 
Old October 3rd, 2005, 01:10 PM
Registered User
 
Join Date: Apr 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That's possible, but then all the patients in table 2 with the same ************ 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.





Similar Threads
Thread Thread Starter Forum Replies Last Post
linking anukagni Access 1 March 28th, 2006 08:21 AM
Compiling/Linking nulogix C++ Programming 8 November 9th, 2005 06:46 PM
Linking Tables Con Access VBA 2 September 24th, 2003 04:32 PM
RE: Linking sherr8 SQL Server 2000 2 July 30th, 2003 02:29 PM
Linking sherr8 Access 2 July 30th, 2003 02:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.