Subject | Problems with a query using LEFT OUTER JOINS. |
---|---|
Author | John M Molloy |
Post date | 2005-02-05T03:13:47Z |
As a beginner, the following problem defeats me, at least in the most
efficient manner of resolution:
I have built a query part of which is a cascaded join between three tables:
The structure of that query (abbreviated):
1. Journeys ( The master; approximately a total of 15000
records from which to query 1 or more)
primary key 'ID'
plus other fields...Date, time,etc.
____________________________________
LEFT OUTER JOIN to:
2. Routes (references Journeys.ID) - averaging 6 records per Journey -
joined.
Primary key: ID + Journey_ID (referenced by other tables)
The problem fields:
Departure_ID *
Arrival_ID *
plus other fields...timings, distances, etc.
_____________________________________
LEFT OUTER JOIN(s) ? to
3. Places
Primary Key 'Place_ID'
Placename
plus other fields...descriptions
_____________________________________
The problem: How to reference Places.Place_ID from Routes.Departure_ID and
Places.Place_ID from Routes.Arrival_ID
* Wish-list: to have 2 x 1:1 joins between Routes and Places (i. -
Departure_ID to Place_ID and ii. - Arrival_ID to PlaceID extracting
Places.Placename for each.
But, am I correct in saying that this is illegal?
My solution: I currently use, temporarily, a simple look-up of
Places.Placename and string type fields in 'Routes' instead of the Integer
link field, but normalization states that this is not good practice and to
me, a waste valuable resource space.
Any suggestions, please.
Regards
Airsoft
********
[Non-text portions of this message have been removed]
efficient manner of resolution:
I have built a query part of which is a cascaded join between three tables:
The structure of that query (abbreviated):
1. Journeys ( The master; approximately a total of 15000
records from which to query 1 or more)
primary key 'ID'
plus other fields...Date, time,etc.
____________________________________
LEFT OUTER JOIN to:
2. Routes (references Journeys.ID) - averaging 6 records per Journey -
joined.
Primary key: ID + Journey_ID (referenced by other tables)
The problem fields:
Departure_ID *
Arrival_ID *
plus other fields...timings, distances, etc.
_____________________________________
LEFT OUTER JOIN(s) ? to
3. Places
Primary Key 'Place_ID'
Placename
plus other fields...descriptions
_____________________________________
The problem: How to reference Places.Place_ID from Routes.Departure_ID and
Places.Place_ID from Routes.Arrival_ID
* Wish-list: to have 2 x 1:1 joins between Routes and Places (i. -
Departure_ID to Place_ID and ii. - Arrival_ID to PlaceID extracting
Places.Placename for each.
But, am I correct in saying that this is illegal?
My solution: I currently use, temporarily, a simple look-up of
Places.Placename and string type fields in 'Routes' instead of the Integer
link field, but normalization states that this is not good practice and to
me, a waste valuable resource space.
Any suggestions, please.
Regards
Airsoft
********
[Non-text portions of this message have been removed]