I've been beating my head against this one for a while, so any tips are very much appreciated. It really seems like it shouldn't be this hard.
I have data like what is shown in the "Data:" box in the picture below, and I would like to create a query that will return something like the "Goal:" box in the picture. I want a count of the distinct ID for records who's TimeStart is before the Time but who's TimeEnd is after.
I have the Time field in another table, all I can think to do is a full outer join to the other table and maybe like a case when.