I have an Event table that specifies a date range with start_date
and end_date
fields. I have another date range, specified in code, that defines the
+1 for pop Catalin, but alas I have no voting privilege.
The restrict condition you want is just the standard way to express Allen's "OVERLAPS" operator.
Additional SQL caveat : if end_date is nullable, be sure to treat nulls in those columns as "the end of time".
Additional functional caveat : be sure to adapt the usage of '<=' versus '<' to whether or not the recorded time periods include the end date or not.