finally have a working query for active and inactive systems.. inactive = find latest checkin for each instance.. if a checkin is not gt than start_date => inactive