I have two tables, operators (who operates an aircraft) and history (history is the movements of an aircraft). What I need to do is only show the operators which have an "active" flag on the history table as the last entry. For instance, I have in the history table 10 entries for an aircraft in the history table. the last entry for this is for British Airways and the aircraft is active. this should, therefore, should allow British Airways to be listed on the output. I then have 10 entries for an aircraft which was with Fly Uk, then has been sold to British Airways. Both had or have the aircraft as active, but as British Airways is the current active operator for the aircraft it shouldn't show FLY UK in this list. Both Operators may have multiple aircraft in the list, some as active and some as on order, stored, etc. tables -
History has a field for operator and status (where this can be active, stored, scrapped, written off)
Aircraft Has a field for the OperatorName
so it should be something like
select *
from operators
where max history.status = 'active' or 'stored' or 'grounded';
however it's not working?
I have tried various things with the code, changed php version and no better in the situation
select *
from operators
where max history.status = 'active' or 'stored' or 'grounded';
I don't get any output with this