开发者

Enforce Multiple Relationships Between Two Tables In Access

I want to create (and enforce) multiple "one-to-many" relationships between the primary key of one table to attributes of another.

Hopefully this example will explain better. I have a table for a ch开发者_如何学JAVAaracter in a game. The character can hold one item in each hand.:

Table: GamePlayer
gamePlayerID    Number  PK
name            Text    Unique
classID         Number  FK->PlayerClass.classID
leftHandItem    Number  FK->Items.itemID
rightHandItem   Number  FK->Items.itemID

How do I implement the leftHandItem -> Items.itemID and rightHandItem -> Items.itemID with enforcing referential integrity.


In the Relationships window, add the Items table twice. The second occurence will automatically get an alias. Use the 2 occurences like if they were 2 distinct tables to create relationships.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜