Question about composite key

Apr 11, 2011 at 8:23 PM

I tried looking through this forum and the examples but I couldn't find anything that was super clear.

I have a large set of lookup codes that I'm going to store in table, I then have a number of objects that reference a subset of those keys through a join table. 

ie) Each project uses a subset of the master codes and so each project BO should return an nice index subset of the allowed codes from the master table.

so

LookupTable(LookupKey) 

Key1, Value 1

Key2, Value 2

ProjectAllowedLookupTable(ProjectKey, LookupKey)  -> Key = Tuple(ProjectKey, LookupKey)

123, Key1

222, Key1

222, Key2

ProjectTable(ProjectKey)

So I end up with three tables but my question is how to best define the tables/indexes on the AbcAllowedLookupTable so I can do a simple join.  If I define a composite key I do I query on just one part of the key?  If it is a tuple can I say Join on Key[x] ??? 

Thanks

jack