List:General Discussion« Previous MessageNext Message »
From:Dotan Cohen Date:October 19 2011 1:57pm
Subject:What is wrong with this outer join?
View as plain text  
mysql> select * from beers;
+----+-----------+--------+
| ID | name      | colour |
+----+-----------+--------+
|  1 | carlsburg |      2 |
|  2 | tuburg    |      1 |
|  3 | tuburg    |      9 |
+----+-----------+--------+
3 rows in set (0.00 sec)

mysql> select * from colours;
+----+--------+
| id | colour |
+----+--------+
|  1 | red    |
|  2 | green  |
|  3 | blue   |
+----+--------+
3 rows in set (0.00 sec)

mysql> select * from beers inner join colours on beers.colour = colours.ID;
+----+-----------+--------+----+--------+
| ID | name      | colour | id | colour |
+----+-----------+--------+----+--------+
|  1 | carlsburg |      2 |  2 | green  |
|  2 | tuburg    |      1 |  1 | red    |
+----+-----------+--------+----+--------+
2 rows in set (0.00 sec)

mysql> select * from beers outer join colours on beers.colour = colours.ID;
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 'outer join colours on beers.colour = colours.ID'
at line 1


So I've gone looking the fine manual, here:
http://dev.mysql.com/doc/refman/5.6/en/join.html

The manual references natural outer joins and requires curly brackets
and I'm frankly not making sense of it. Left, right, and inner joins
work as I expect them too, and fishing for examples in google doesn't
find anything unusual. How exactly am I erring?

Thanks!

-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com
Thread
What is wrong with this outer join?Dotan Cohen19 Oct
  • Re: What is wrong with this outer join?MySQL)19 Oct
    • Re: What is wrong with this outer join?Dotan Cohen19 Oct
      • Re: What is wrong with this outer join?MySQL)19 Oct
        • Re: What is wrong with this outer join?Dotan Cohen20 Oct
          • Re: What is wrong with this outer join?MySQL)20 Oct
            • Re: What is wrong with this outer join?Peter Brawley20 Oct
            • Re: What is wrong with this outer join?Dotan Cohen20 Oct
Re: What is wrong with this outer join?Dotan Cohen19 Oct
  • Re: What is wrong with this outer join?hsv20 Oct