INNER JOINT with 1 master table and 2 tables

# Thread: INNER JOINT with 1 master table and 2 tables

1. Senior Member
Join Date
Dec 1969
Posts
218

## INNER JOINT with 1 master table and 2 tables

Hi,<BR><BR>One master table have 2 relations with 2 differents tables.<BR><BR>y_table &#060;=&#062; master_table &#060;=&#062; x_table<BR><BR>To get fields from master_table of the x and y tables I try:<BR><BR>SELECT * from master <BR>INNER JOIN x ON master.no = x.no AND<BR>INNER JOIN y ON master.no = y.no<BR>...<BR><BR>OR<BR>INNER JOIN (x ON master.no = x.no)<BR>AND (y ON master.no = y.no)<BR><BR>And more test...<BR><BR>It&#039;s more easy then master &#060;=&#062; x &#060;=&#062; y where most exemple show:<BR><BR>SELECT * FROM master <BR>INNER JOIN (x INNER JOIN y <BR>ON (x.no = y.no)) <BR>ON master.no = x.no; <BR><BR>Tx.

2. Senior Member
Join Date
Dec 1969
Posts
213

## RE: INNER JOINT with 1 master table and 2 tables

Your syntax is slightly wrong. Try this:<BR><BR>SELECT * FROM master INNER JOIN x on master.no = x.no<BR> INNER JOIN y on master.no = y.no<BR><BR>Jeremy<BR>

3. Senior Member
Join Date
Dec 1969
Posts
218

## RE: INNER JOINT with 1 master table and 2 tables

Tx,<BR><BR>Of course, I try this first without "and" but NO, it&#039;s not work...<BR><BR>And the field are ok:<BR>SELECT * FROM master INNER JOIN x on master.no = x.no (work fine)<BR>SELECT * FROM master INNER JOIN y on master.no = y.no (work fine to)<BR><BR>But the 2 dont work...<BR>SELECT * FROM master INNER JOIN x on master.no = x.no<BR>INNER JOIN y on master.no = y.no<BR><BR><BR>SELECT * FROM master <BR>

4. Senior Member
Join Date
Dec 1969
Posts
218

## RE: INNER JOINT dont Work

The error is "missing operator"<BR><BR>Reason why I ad the "and" operator between the 2 joint...

5. Senior Member
Join Date
Dec 1969
Posts
213

## RE: INNER JOINT with 1 master table and 2 tables

If this syntax I suggested doesn&#039;t work you are not using an ANSI compliant database. What is the database system you are using?

6. Senior Member
Join Date
Dec 1969
Posts
218

## RE: INNER JOINT - Access

Simple ACCESS base !<BR><BR>Local and server

7. Senior Member
Join Date
Dec 1969
Posts
213

## RE: INNER JOINT - Access

Ach so. Then it&#039;s probably just a matter of shuffling with the order of the tables and placing the &#039;(&#039; and &#039;)&#039; in the right places (don&#039;t you love Access :). Have you tried it like this:<BR><BR>SELECT *<BR> FROM x INNER JOIN<BR> (master INNER JOIN y on master.no = y.n)<BR> ON x.no = master.no;<BR>

8. Senior Member
Join Date
Dec 1969
Posts
218

## RE: INNER JOINT - Access

Yap, my webserver dont use SQL server right now !!<BR><BR>I dont try this. Wondering about the ORDER. I will try it.<BR>Any way, I use a second connexion for catch the y relation.<BR><BR>So, tx a lot. (hope my "prooooooofessionnel" webserver move on SQL server and w2k soon!!!)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•