hconnorjr wrote:
> I think that my goal is something like this,
>
> PhysicianID
> PhysicianSpecialtyID
>
>
> PhysicianSpecialtyID
> PhysicianSpecialtyName
What you need is a lookup table.
physicians
PhysicianID
PhysicianName
specialties
PhysicianSpecialtyID
PhysicianSpecialtyName
physician2specialty
PhysicianID
PhysicianSpecialtyID
The lookup table (physician2specialty) contains just two
columns, and
both IDs are declared as a joint primary key. So let's say
that
PhysicianSpecialtyID 1 is Nose jobs and PhysicianSpecialtyID
2 is Tummy
tucks. You have two physicians: Jones (PhysicianID 1) and
Smith
(PhysicianID 2). The lookup table looks like this:
PhysicianID PhysicianSpecialtyID
1 2
2 1
2 2
Jones does just Tummy tucks, but Smith does both Nose jobs
and Tummy tucks.
By declaring PhysicianID and PhysicianSpecialtyID as a joint
primary
key, you ensure that the combination is always unique. In
other words,
you cannot list the same specialty against an individual
physician more
than once. When updating a physician, you delete all existing
records
connected with that physician in the lookup table, and insert
the
updated combination. So, if Jones starts doing Nose jobs, you
delete all
records in the lookup table where PhysicianSpecialtyID = 1.
Then
INSERT INTO physician2specialty (PhysicianID,
PhysicianSpecialtyID)
VALUES (1,1),(1,2)
It sounds complicated, but is quite simple to implement.
--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of
ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/