Martin,
Your question has nothing to do with T-SQL.
It's a task from school math.
To find the correct answer you need:
- stop browsing Internet for it;
- take a piece of paper;
- draw a time line on it;
- mark all time intervals from the table on the time line;
- mark the search interval on the same line.
Draw several different variations of the picture: with overlapping intervals, with one search interval covering several table intervals, etc.
Allocate 5 minutes of your time to analyze the pictures and figure out what are the criteria for selecting the right intervals.
I'm pretty sure you can find the answer.
_____________
Code for TallyGenerator