On Wed, Aug 29, 2001 at 10:01:23PM -0600, s. keeling wrote:
> On Thu, Aug 30, 2001 at 12:21:28AM +0100, Kemal Danisman wrote:
> >
> > Some people say translate INNER JOINS from Access to WHERE clauses, some say
>
> Personally, I'd say drop Access and all references to it, and begin
> redesign using a sensible alternative which doesn't encourage the
> production of such abominations, but that's just what you're
> attempting, right? :-)
>
> > mySQL version (with my "custom" aliases to help clarify relationships)
> > ====================================================
Does it help at all to look at this in a somewhat more structured way?
At least it might help eliminate gross programming errors:
SELECT Routes.RouteID,
Flights.FlightNo,
Aircraft.AircraftType,
DEPARTCITY.CityName
AS 'Departure city',
DEPARTAIRPORT.AirportName AS 'Departure airport',
ARRIVALCITY.CityName AS 'Arrival city',
ARRIVALAIRPORT.AirportName AS 'Arrival airport'
FROM Aircraft,
Routes,
Flights,
Cities AS DEPARTCITY,
Cities AS ARRIVALCITY,
Airports AS DEPARTAIRPORT,
Airports AS ARRIVALAIRPORT,
AirportLinks AS LINK1,
AirportLinks AS LINK2
WHERE Routes.FlightNumber = Flights.FlightID AND
DEPARTAIRPORT.AirportID = LINK1.AirportID AND
DEPARTCITY.CityID = LINK1.CityID AND
Routes.Origin = DEPARTAIRPORT.AirportID AND
Routes.Destination = ARRIVALAIRPORT.AirportID AND
ARRIVALAIRPORT.AirportID = LINK2.AirportID AND
LINK2.CityID = ARRIVALCITY.CityID AND
Aircraft.AircraftID = Flights.AircraftType;
#
# I still don't know why you'd want a ";" there.
#
GROUP BY Routes.RouteID,
Flights.FlightNo,
Aircraft.AircraftType,
ARRIVALAIRPORT.AirportName,
ARRIVALCITY.CityName,
DEPARTAIRPORT.AirportName,
DEPARTCITY.CityName;
--
Any technology distinguishable from magic is insufficiently advanced.
[EMAIL PROTECTED] TopQuark Software & Serv. Contract programmer, server bum.
---------------------------------------------------------------------
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