SELECT id FROM [table] WHERE [date] BETWEEN ISNULL( date_started, 0 ) AND ISNULL( date_ended, getDate() )