An answer won't make much sense if you truly don't have a clue.
W3schools has a good intro on joins.
http://www.google.com/search?hl=en&q=sql+join+syntax&btnG=Google+Search
cheers,
KB
On 4/20/05, Perry Merritt <swdweeb@stripped> wrote:
> Hi, I'm a novice.
>
> I've designed a database that supports many to many relationships (actually many to
> many to many) and I need help creating the query to find my data. I know things like JOINs
> exist, but don't have a clue how to use them.
>
> I have three main tables and two link tables, The main tables are A, B, and C. Each
> are defined with id INT and word VARCHAR(32); The link tables are X and Y. X links A and B
> with the columns a_id and b_id. Y links the tables B and C with columns b_id and c_id.
>
> Here's what I want to accomplish:
>
> Get the A.id where A.word = "some value"
> Use A.id to search X where X.a_id=A.id (from above)
> Use all occurences of X.a_id = A.id to select word from B using B.id=X.b_id
> AND finally,
> select C.id where C.Word = "Some other value"
> and given Y.c_id = C.id use the matching Y.b_id to further limit the select on
> B.word
>
> Can this convoluted mess be understood and if so, can a single query pull it off?
>
> I'm implementing this in perl, so I can break the queries into pieces if I absolutely
> have to.
>
> Thanks