Can MySQL / SQL's short hand of "Using" be used without saying "Inner Join" ?

Posted by Jian Lin on Stack Overflow See other posts from Stack Overflow or by Jian Lin
Published on 2010-04-24T13:08:14Z Indexed on 2010/04/24 13:13 UTC
Read the original article Hit count: 313

Filed under:
|
|
|
|

The following 2 statements are to join using gifts.giftID = sentgifts.giftID:

mysql> select * from gifts, sentgifts using (giftID);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'using
 (giftID)' at line 1

and the second one:

mysql> select * from gifts INNER JOIN sentgifts using (giftID);
+--------+------------+----------------+---------------------+--------+------------+--------+------+---------------------+
| giftID | name       | filename       | effectiveTime       | sentID | whenSent   | fromID | toID | trytryWhen          |
+--------+------------+----------------+---------------------+--------+------------+--------+------+---------------------+
|      2 | teddy bear | bear.jpg       | 2010-04-24 04:36:03 |      4 | 2010-04-24 |   NULL |  111 | 2010-04-24 03:10:42 |
|      6 | beer       | beer_glass.png | 2010-04-24 05:18:12 |      5 | 2010-03-03 |     11 |   22 | 2010-03-03 00:00:00 |
|      6 | beer       | beer_glass.png | 2010-04-24 05:18:12 |      6 | 2010-04-24 |     11 |  222 | 2010-04-24 03:54:49 |
|      6 | beer       | beer_glass.png | 2010-04-24 05:18:12 |      7 | 2010-04-24 |      1 |    2 | 2010-04-24 03:58:45 |
+--------+------------+----------------+---------------------+--------+------------+--------+------+---------------------+
4 rows in set (0.00 sec)

Can the first statement also use the "using" shorthand? It seems that when it is used then the word "Inner Join" must be specified... but the first statement is actually an inner join?

© Stack Overflow or respective owner

Related posts about sql

Related posts about mysql