Howdy,
Inner and outer joins.
Actually there is a good example for an outer join with doctors and
patients.
Patients have a relationship with Doctors, yes.
Suppose I want to list all the doctors and all the patients assigned to
each.
If you do an inner join between two table it returns the set of records
that match on the linked field(s).
But what if you have a doctor in the database that has no patients.
Using an inner join you would not see the doctor record, since it can
not match to a DoctorID in the patient table.
In this case you need to use an OUTER join which means, return me all
the records that match between the tables, and then depending on if it
is a LEFT or RIGHT outer join also return all records in the lefthand or
righthand table that does not have a a match in the other.
OK
- two doctors
Williams and Parker
- one patient
Crathers
To get both docotors and the patient into a result set you need to use a
query such as
SELECT
"Medical Doctor"."Surname" AS "Doctor",
"Patient"."Surname" AS "Patient"
FROM { OJ "Medical Doctor" LEFT OUTER JOIN "Patient" ON "Medical Doctor"."ID Number" =
"Patient"."Medical Doctor ID" }
more later..
Drew
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@documentation.openoffice.org
For additional commands, e-mail: dev-h...@documentation.openoffice.org