>select * > from DistanceTable > where (FK_Where_I_Am in (FK_city1, FK_city2)) > and (Distance < = 50.0) >>
>The result needs to be joined >- with the city table on FK_City2 if (FK_Where_I_Am == FK_city1), and >- with the city table on FK_City1 if (FK_Where_I_Am == FK_city2) >>
>select * > from DistanceTable > join CityTable on (pk_City = FK_City2) > where ( FK_city1 = FK_Where_I_Am ) > and (Distance < = 50.0) >union all >select * > from DistanceTable > join CityTable on (pk_City = FK_City1) > where ( FK_city2 = FK_Where_I_Am ) > and (Distance < = 50.0) > >>