The reason for the number of queries feeding the main query is that I cannot think of another way of getting the results in a single query. Each sub query has the following data: Contract number, planned visit 1, actual visit 1, date (between 2 dates), Fix (number/digit code).
The constant will...