General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Help with Inner Join
I’m working on a class hierarchy with four levels. The normalized structure is as follows:
C1 n..n C2 1..n C3 n..n C4
Class1 to Class2 is many-to-many, Class2 to Class3 is 1 to many and so on….
What I would like, are items from Class4 based on the selection of the previous classes.
The items that currently appear from Class4 seem to ignore Class1, based on the below select statement.
If someone could point me in the right direction I would be most grateful.
SELECT Class4.item;
FROM Class4;
INNER JOIN C1_C2 ON Class1.C1id = C1_C2.C1id;
INNER JOIN Class2 ON Class2.C2id = C1_C2.C2id;
INNER JOIN Class3 ON Class2.C2id = Class3.C2id;
INNER JOIN C3_C4 ON Class3.C3id = C3_C4.C3id;
INNER JOIN Class4 ON Class4.C4id = C3_C4.C4id;
WHERE Class3.C3id = 1;
AND Class2.C2id = 2;
AND Class1.C1id =3
Sorry if this looks too cryptic.
Peter In-Albon
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only