Reputation: 139
I want to return all flights between with the departure date greater or equal to a certain date e.g 2016-12-09 and less than or equal 2016-12-11
I want to include all departure airports which which have 'London' in the airport name and all arrival airports which have 'Charles' or 'Orly' in the airport name. When I run this query I don't get any results.
Upvotes: 1
Views: 37
Reputation: 782508
You should be using OR
between the arrival airport checks, not AND
.
WHERE departure.airport_name_en LIKE '%London%'
AND (arrival.airport_name_en LIKE '%Charles%'
OR arrival.airport_name_en LIKE '%Orly%')
AND departure_date BETWEEN '2016-12-09' AND '2016-12-11'
AND
requires both conditions to be true, but unless the airport name is something like Charles de Orly International
, it won't have both Charles
and Orly
in it. You even said it correctly in the question:
arrival airports which have 'Charles' or 'Orly' in the airport name
Make sure you use parentheses when you mix AND
and OR
conditions, because the precedence isn't what you likely expect.
Upvotes: 1