Many to many cross reference query

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!


I am looking to pick up the relationship between items in a
cross-reference table. For example, searching for c OR f (bracketed
below to highlight them), I want to list the other right hand side keys
that are linked by the left hand side key. So in the below case, "a" is
linked 3 times due to (c), b is linked twice due to (c), d is linked
twice due to (c) and (c OR f) and finally e, linked once due to (c).

1 | a
1 | b
1 | (c)
1 | d
2 | a
2 | b
2 | (c)
3 | z
4 | a
4 | (c)
5 | (c)
5 | e
6 | (f)
6 | (c)
6 | d

Just wondering what the best way of doing this is, and how the result
can be ranked by the number of hits (so a,b,d,e) and how to get the
number of links (3, 2, 2, 1)

Hope this is clear. This has had me scratching my head for a while :/

Many thanks in advance!

Site Timeline