Hi all,
I am trying to wrote a query that returns a result based on the content of two tables.
Table 1, contains flight information
Table 2, contains airline contact details
This is what I have so far:
SELECT DISTINCT
f.CodeShare,
f.DayNumber,
f.ArriveDepart,
f.ScheduledTime,
f.SchStamp,
f.EstimatedTime,
f.EstStamp,
f.Flight,
f.FlightNumber,
f.IATALookup,
f.`Status`,
f.Terminal,
f.AirlineCode,
a.Airline,
a.AirlineContact
FROM
LHRFlightStats24 f, HotelAirlineContacts a
WHERE f.AirlineCode = a.Airline
AND f.EstStamp - 3600 > f.SchStamp
AND f.ArriveDepart = 'O'
AND f.CodeShare = '0'
OR f.`Status` = 'C'
ORDER BY f.ScheduledTime ASC
If I remove the "OR" criteria the result is fine but with the inclusion of the "OR"
the result brings back rows which include ignors the "AND f.CodeShare = '0'" part.
Can anyone see where I am going wrong and offer some advice.
Many thanks.