Goofy
08-20-2003, 12:46 PM
Greetings! I really need help to create an SQL query cuz I really am having troubles figuring this one out.
Here are my tables:
tblItem tblContents tblProperties
=========== =========== =============
*pkIdItem *fkIdItem *pkIdProperty
sDescrItem *fkIdProperty sDescrProp
sValue
The * represents the primary keys.
The relations are as follow:
tblContents.fkIdItem is a foreign key of tblItem.pkIdItem
tblContents.fkIdProperty is a foreign key of tblProperties.pkIdProperty
Contents of tblItem:
pkIdItem sDescrItem
-------- ----------
1 Radio
2 Phone
3 Toolbox
Contents of tblProperties:
pkIdProperty sDescrProp
-------- ----------
1 Shape
2 Height
3 Weight
Contents of tblContents:
fkIdItem fkIdProperty sDescrProp
-------- ------------ ----------
1 1 Other
1 2 20
1 3 30
2 1 Round
2 2 20
2 3 45
3 1 Square
3 2 20
3 3 30
Now, what I want to do is to get a list of Item that have have a Height of 20 AND a weight of 30.
I know it really looks simple, but I just can't seems to figure out how to build the query!
Thank you for your help, it really is appreciated!
:D
Here are my tables:
tblItem tblContents tblProperties
=========== =========== =============
*pkIdItem *fkIdItem *pkIdProperty
sDescrItem *fkIdProperty sDescrProp
sValue
The * represents the primary keys.
The relations are as follow:
tblContents.fkIdItem is a foreign key of tblItem.pkIdItem
tblContents.fkIdProperty is a foreign key of tblProperties.pkIdProperty
Contents of tblItem:
pkIdItem sDescrItem
-------- ----------
1 Radio
2 Phone
3 Toolbox
Contents of tblProperties:
pkIdProperty sDescrProp
-------- ----------
1 Shape
2 Height
3 Weight
Contents of tblContents:
fkIdItem fkIdProperty sDescrProp
-------- ------------ ----------
1 1 Other
1 2 20
1 3 30
2 1 Round
2 2 20
2 3 45
3 1 Square
3 2 20
3 3 30
Now, what I want to do is to get a list of Item that have have a Height of 20 AND a weight of 30.
I know it really looks simple, but I just can't seems to figure out how to build the query!
Thank you for your help, it really is appreciated!
:D