Yeah, I know. I just meant the comma with the appropriate WHERE clause was
equivalent to INNER JOIN with an ON or USING clause. Sorry if that wasn't
clear. I prefer the comma operator. By using commas, I was able to get rid
of all the parenthesis and simplify the FROM and WHERE clauses.

--jeff

----- Original Message -----
From: "Paul DuBois" <[EMAIL PROTECTED]>
To: "Jeff Kilbride" <[EMAIL PROTECTED]>; "Michael J. Mitchell"
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, October 15, 2002 6:46 PM
Subject: Re: Query using the same table twice


> At 18:03 -0700 10/15/02, Jeff Kilbride wrote:
> >Commas in the FROM clause are the same as INNER JOIN.
>
> Not any more.  That was true up until 3.23.17, at which point INNER
> JOIN was changed to require an ON or USING clause.
>
> >  To make it clearer and
> >easier to understand, I'd write it something like this:
> >
> >SELECT psh.StatID,
> >pt1.TeamName AS Home,
> >pt2.TeamName AS Visitor,
> >psh.GameDate
> >FROM PH_TEAMS pt1, PH_TEAMS pt2, PH_SCORE_HEADER psh
> >WHERE psh.Home = pt1.TeamID
> >AND psh.Visitor = pt2.TeamID;
> >
> >--jeff
> >
> >----- Original Message -----
> >From: "Michael J. Mitchell" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Sent: Tuesday, October 15, 2002 12:24 PM
> >Subject: Query using the same table twice
> >
> >
> >>
> >>  I am trying to make a query that usses the same table twice.  I have a
> >table
> >>  of scores and a table of teams and the scores table has both the
visitors
> >>  and home team in it as an ID that is in the teams table.  I can't get
my
> >>  MySQL statement to work, it does not like the parentheses.
> >>
> >>  SELECT PH_SCORE_HEADER.StatID, PH_TEAMS.TeamName AS Home,
> >>  PH_TEAMS_1.TeamName AS Visitor, PH_SCORE_HEADER.GameDate
> >>
> >>  FROM PH_TEAMS AS PH_TEAMS_1 INNER JOIN (PH_TEAMS INNER JOIN
> >PH_SCORE_HEADER
> >>  ON PH_TEAMS.TeamID = PH_SCORE_HEADER.Home) ON PH_TEAMS_1.TeamID =
> >>  PH_SCORE_HEADER.Visitor;
> >>
> >>  I think the problem is with the Parenthesies, but I don't know how to
> >>  re-write the SQL.
> >>
> >  > Any suggestions?
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to