List:General Discussion« Previous MessageNext Message »
From:Martin Ramsch Date:September 18 1999 12:13am
Subject:Re: What's wrong with my JOIN syntax?
View as plain text  
On Fri, 1999-09-17 13:13:42 -0700, Erhhung Yuan wrote:
> Is there a problem with this query?
> 
> select table1.*
> from table1 inner join table2 on table1.field1 = table2.field1
> where table2.field2 = 1;
> 
> I get the error:
> 
> ERROR 1064: You have an error in your SQL syntax near
> 'on table1.field1 = table2.field1 where table2.field2 = 1'
> at line 1
> 
> why doesn't MySql recognize a standard join syntax?
> I'm using version 3.22.25.

The "INNER JOIN" syntax was introduced with MySQL version 3.23.0, so
your V3.22.25 still doesn't know about it!

But the _standard_ join syntax (in the sense of how a join normally is
written) just is using commas, and any join condition are simply put
in the WHERE part:

  SELECT table1.*
  FROM table1, table2
  WHERE table1.field1 = tabl2.field1
    AND table2.field2 = 1;

Regards,
  Martin
-- 
Martin Ramsch <m.ramsch@stripped> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26  E4 EC 80 58 7B 31 3A D7
Thread
What's wrong with my JOIN syntax?Erhhung Yuan18 Sep
  • Re: What's wrong with my JOIN syntax?Martin Ramsch18 Sep