View Full Version : Creating a table to cross index items in another table


DKDiveDude
09-14-2005, 02:24 PM
How do I create a table that can cross index items in another table. Maybe I am not using the right terms here so let me show a small example.

Say I have a tables of words.
tblWords
numWordID
txtWord

Then I have some entries, all more or less synonyms of each others
fresh
new
clean

Now I want to create a cross-index table, related to the table "tblWords" where I can select synonyms from words already in the table "tblWords", so if I for the word "fresh" add "new" and "clean" as synonyms or entries, if I then go and look at the word "new" it will already have the synonyms "fresh" and "clean", likewise the entry "clean" will then have the synonyms "fresh" and "new".

Kind of a many to many relationship junction table but only with one table!

I hope my explanation have not been to confusing, but let me know if you need a clarification.

Thanks

llkhoutx
09-15-2005, 07:00 PM
Create a long integer field in the table, which is the primary index of the child (linked) table.

DKDiveDude
09-16-2005, 06:40 AM
Create a long integer field in the table, which is the primary index of the child (linked) table.

:eek: It is still a bit early in the morning for me, so I may be a bit slow, but can you perhaps elaborate a bit on your solution? Thanks!

llkhoutx
09-16-2005, 11:51 AM
Paren table
ParentID - autonumber key
field2
field3
etc.

Child Table
ChildID - autonumber key
ParentID - long integer
field5
field6

DKDiveDude
09-19-2005, 09:10 AM
Paren table
ParentID - autonumber key
field2
field3
etc.

Child Table
ChildID - autonumber key
ParentID - long integer
field5
field6

Can somebody please contribute to this as one of us seems to be misunderstanding each other.

The above seems to be an example of a simple two table relation database, with a parent and a child, something I already know thanks :)

I need something a lot more complex, so please read my first post again thanks!

llkhoutx
09-19-2005, 09:48 AM
I got it backwards

Parent table
ParentID - autonumber key
fk2tblWord - long integer index to tblWords
field2
field3
etc.

tblWords
WordID - autonumber key
sSynonym

fk2child is returned via the bound column of a combo box which has tblWords as its recordsource.

pmcleod
09-22-2005, 12:04 PM
I need to do something like this with an event.

tblEvent
EventID EventTitle
1 memo content
2 data
3 more memo content
4 some info
5 more stuff
6 other text

tblEventRelationships
EventParrent EventChild
1 4
1 3
1 5
6 1
3 2

I tried the idea sugested here but it didn't seem to give the cross referencing that I had hoped for .... example 1 is related to 4,3, and 5 while 6 is related to 1 implying an extended relationship to 4,3, and 5.

If I look at record 1 I can see that it is related to 4,3,5 but if I look at record 6 I can only see that it is related to 1. How would the table drill further to see that 1 is also related to 4,3,5?