List:General Discussion« Previous MessageNext Message »
From:Kipp Grose Date:November 22 1999 3:16pm
Subject:MySQL INNER JOIN Question.
View as plain text  
   I'm in the middle of porting an application I've written from Cold
Fusion/MS-SQL server on NT to PHP/MySQL on FreeBSD. (MySQL v.3.22.27)

   I've ran into a little hitch I can't get around.  I have this query
that looks like this: 

--============================================================--

SELECT main.id, 
       main.title,
       main.description,
       main.date_entered,
       main.type_id,
       main.url,
       main.keywords,
       s_housing.approval,
       type.type,
       type.type_id
                   
FROM (main INNER JOIN s_housing ON main.id = s_housing.id)
     INNER JOIN type ON main.type_id = type.type_id
                   
WHERE s_housing.approval = 'YES' AND main.type_id != 4 
                   
ORDER BY title, type

--============================================================--

   It works fine in MS-SQL server.  In MySQL it chokes on the Inner Joins.
I get a syntax error.  I've searched and searched, but I can't find any
info on how to "convert" this query so it works in MySQL.

   In the MySQL manual, all I could find about inner joins is this one
sentance:

   "INNER JOIN and , (comma) are semantically equivalent. Both do a full
    join between the tables used. Normally, you specify how the tables
    should be linked in the WHERE condition."

   I've never seen the ON operator used in a WHERE clause before.  I'm not
saying you can't, I've just never seen that syntax.  I just need to see an
example of a 3 table inner join, so I know how to modify my queries
accordingly.

   Any help anyone can give me would be greatly appreciated...



Kipp Grose 
Database Developer
kgrose@stripped   
tel: 416.596.0212 x13  fax: 416.596.1374

Web Networks
Internet Solutions for People Not for Profit 
http://www.web.net  ----  http://community.web.net 



Thread
MySQL INNER JOIN Question.Kipp Grose22 Nov
  • Re: MySQL INNER JOIN Question.sinisa22 Nov