Graham Anderson wrote:
> What is the proper way to say this ?
> SELECT C.City, N.Distance
> FROM Cities C
> JOIN Nearbycities N ON C.CityId =ci 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
> learning :)
Unless I missed something... Why did you make it so hard ?
SQL is meant to be easy :)
SELECT c.city, n.distance
FROM Cities c, Nearbycities n
WHERE c.cityid = n.primarycityid
AND c.city = 'Los Angeles'
AND n.distance < 20