Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
OUTER/INNER JOIN Query question
I have a 3 table query, which I originally generated with the
VFP Query builder. The original VFP query looks like this:
SELECT parts.whatever, ..., make.whatever , parts_a.whatever;
FROM data1!parts LEFT OUTER JOIN data1!make;
INNER JOIN data1!parts Parts_a ;
ON Make.m_sub_part = Parts_a.p_part_id ;
ON Parts.p_part_id = Make.m_part_id;
ORDER BY Parts.p_part_number;
INTO TABLE parts_b.dbf
I was able to save this query, but since I thought the
INNER JOINs should be next to their respective ONs, and I
thought it was a bug with the VFP query editor, I changed
it to read like this:
SELECT Parts.whatever, make.whatever, parts_a.whatever;
FROM data1!parts LEFT OUTER JOIN data1!make;
ON Parts.p_part_id = Make.m_part_id;
INNER JOIN data1!parts Parts_a ;
ON Make.m_sub_part = Parts_a.p_part_id ;
ORDER BY Parts.p_part_number;
INTO TABLE parts_c.dbf
The results I get are very different. I want a LEFT
OUTER JOIN between parts and make, which I was getting
from my first query, but not from my second query. I
am not sure what I am getting from my second query,
but it does not show all the records from parts, which
is what I would expect from a left outer join.
What am I doing wrong?
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement