flodhest network

Select timespan

The illustration below tries to show two timespans defined in a database. The timespans is defined with a "start" and a "end" column. "match timespan" is a fixed timespan defined by "t1" and "t2", which is used to select all rows with a timespan overlapping (partially or totally) the fixed timespan.

match timespan
timespan #1
timespan #2
SELECT * from my_table
    WHERE
    start BETWEEN t1 AND t2
    OR
    end   BETWEEN t1 AND t2
    ;