Using SQL to check time intervals

Original text of this message