|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
What's the difference between:
SELECT accountno, name FROM accounts, customers WHERE accounts.customerno = custommers.customerno; and SELECT accountno, name FROM accounts INNER JOIN customers ON accounts.customerno = custommers.customerno; ? Are there any theoretical differences? Any practical differences? /David |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
pinkfloydhomer@gmail.com wrote:
> What's the difference between: > > SELECT accountno, name > FROM accounts, customers > WHERE accounts.customerno = custommers.customerno; > > and > > SELECT accountno, name > FROM accounts INNER JOIN customers > ON accounts.customerno = custommers.customerno; > > ? > > Are there any theoretical differences? Any practical differences? > > /David The second one is easier to change to say a left join. Also, when you add more than one join, the second one is far clearer to read. Also, as I'm sure you read in the manual, "However, the precedence of the comma operator is less than of INNER JOIN, CROSS JOIN, LEFT JOIN, and so on. If you mix comma joins with the other join types when there is a join condition, an error of the form Unknown column 'col_name' in 'on clause' may occur. Information about dealing with this problem is given later in this section." http://dev.mysql.com/doc/refman/5.0/en/join.html |
|
![]() |
| Outils de la discussion | |
|
|