Foreword:
There is a requirement in the project that needs to be fuzzy searched according to the time period; for
example: the
limited period of the activity setting is: 2020-08-10 00:00:00 to 2020-08-30 00:00:00 The
query conditions are: 2020-08-03 00:00:00 to 2020-09-01 00:00:00
select
*
from activity
where
activity_start_time BETWEEN '2020-08-03 00:00:00' and '2020-09-01 00:00:00'
or activity_end_time BETWEEN '2020-08-03 00:00:00' and '2020-09-01 00:00:00'
or '2020-08-03 00:00:00' BETWEEN activity_start_time and activity_end_time
or '2020-09-01 00:00:00' BETWEEN activity_start_time and activity_end_time