List:General Discussion« Previous MessageNext Message »
From:Graham Anderson Date:March 31 2005 11:17pm
Subject:Newbie: MYSQL nested query question
View as plain text  
What is the proper way to say this ?

SELECT C.City, N.Distance
FROM Cities C
JOIN Nearbycities N ON C.CityId = N.PrimaryCityId
WHERE  N.CityId =
(SELECT Cities.CityId FROM Cities WHERE Cities.city = 'Los Angeles')
AND N.distance < 20

I am trying to enter in a city and get all the nearby cites with 20 
miles
Somehow, I need to join NearbyCities.PrimaryCityId, Cities.CityId, and 
Cities.city

learning :)

Thread
Newbie: MYSQL nested query questionGraham Anderson1 Apr
  • Re: Newbie: MYSQL nested query questionPhilip M. Gollucci1 Apr
    • Re: Newbie: MYSQL nested query questionGraham Anderson1 Apr
      • Re: Newbie: MYSQL nested query questionPeter Brawley1 Apr
        • Re: Newbie: MYSQL nested query questionGraham Anderson2 Apr
          • Re: Newbie: MYSQL nested query questionGraham Anderson2 Apr
      • Re: Newbie: MYSQL nested query questionSGreen5 Apr