Hello. I am a SQL novice and stuck on a query. I'll describe the problem with my current table structure, but if there's a better way to set up the tables, I can still change that, too.
These aren't the real names, but the example is:
Table 1: Thing
Code (K)
Description
etc.
Table 2: CategoryMap
thingCode (K) (Key from the Thing table)
catCode (K) (The actual category - so that a Thing can have multiple categories.)
Suppose Thing contains codes A, B and C and the CategoryMap table looks like:
thingCode catCode
A X
A Y
B X
B Y
B Z
C W
C X
C Y
C Z
I want to be able to choose Thing.description for all Things that have categories X, Y and Z. So, I would want B and C, but not A, from the table above.
Thanks!
Tom
These aren't the real names, but the example is:
Table 1: Thing
Code (K)
Description
etc.
Table 2: CategoryMap
thingCode (K) (Key from the Thing table)
catCode (K) (The actual category - so that a Thing can have multiple categories.)
Suppose Thing contains codes A, B and C and the CategoryMap table looks like:
thingCode catCode
A X
A Y
B X
B Y
B Z
C W
C X
C Y
C Z
I want to be able to choose Thing.description for all Things that have categories X, Y and Z. So, I would want B and C, but not A, from the table above.
Thanks!
Tom