• Sure - I understand how that can happen. But, what do you propose should be the business rule to work out what is a connecting flight and what is not ? Because that is the first step, not for you to pick out instances and say 'this is two flights', but for you to define business rules by which this can be satisfactorily worked out. Once you have business rules ( which probably the client should define ), then you can work on SQL. Until then, until the client has signed off on what you're going to do, you're just asking for code that works today and not tomorrow. With this DB, I think that can't be avoided, which is all the more reason the client needs to sign off on the rules you are implementing.

    If you know the rules, by all means, post them, and we can work on defining them in SQL.