• Its still pretty tough to understand all your business rules here. I think its probably just a weird data model throwing this out of whack, and location and resource schedules would ideally have separate tables, with a many to many table in between guiding the relationship.

    But let me try to summarize.

    So you only want to see results that have both a Location Schedule (IsResSchedule = 0) and a Resource Schedule (ISResSchedule =1).

    Of those results, you only want to see the MOST LIMITING schedules for the pairing. So if location is only available part of the day, but resource all day, you want to see location. And if the opposite is true you want resource.

    If there is a ONETIME schedule, you want to see it and not the WEEKLY schedules.

    This still leaves some open questions.

    What if neither Location nor Resource schedule are limited. Show location or show resource or show both? (Or show one but it doesn't matter which).

    What if BOTH Location and Resource are limited? Show both? Show neither? Show intersection of the schedule times?

    Can there be multiple ONETIME schedule records? In all your examples there is only ever one to show per pairing. Is this ever not the case?

    What happens is the Location has a limited WEEKLY schedule but the Resource has a wide open ONETIME schedule?