I would like to make a sql query than return me the distance between two cities.
SELECT c1.name, c2.name, d.distance
FROM cities_distance d, city c1, city c2
WHERE c1.name = d.name_city1
AND c2.name = d.name_city2
AND c1.id = c2.id
AND (c1.name = 'paris'
AND c2.name = 'berlin')
or (c1.name = 'berlin'
AND c2.name = 'paris');
This query return all lines where Paris or Berlin is registered. But in my database I got just 1 line who match with "Paris-Berlin"
My database (cities_distance
) :
-----------------------------------
| id | city1 | city2 | distance |
| 1 | berlin | paris | 1055 |
| 2 | rome | berlin | 1500 |
-----------------------------------