0

I have two table one contains updated_at (can be more than one row) datetime And second contains started_date and stopped_date(one or more records).

I want select updated_at date which should not in between started_date and stopped_date.

Thanks in advance.

I saw the other Question "Check overlap of date ranges in MySQL".

But this not what I want.

user_location +---+-----+-----+---------------------+ |id | lat | lon | updated_date | +---+-----+-----+---------------------+ | 1 |16.45|75.45|2018-01-09 12:50:57 | | 2 |16.85|75.15|2018-01-09 12:53:45 | | 3 |16.78|75.25|2018-01-09 12:55:48 | | 4 |16.43|75.35|2018-01-09 13:57:35 | | 5 |16.48|75.47|2018-01-09 14:59:30 | | 6 |16.49|75.49|2018-01-10 05:59:58 | | 7 |16.50|75.50|2018-01-10 07:35:15 | +---+-----+-----+---------------------+

location_blocked_datetime

+---+--------------------+---------------------+ |id | start_date | stopped_date | +---+--------------------+---------------------+ | 1 |2018-01-09 05:55:48 | 2018-01-09 07:55:48 | | 2 |2018-01-09 12:51:48 | 2018-01-09 12:56:48 | | 3 |2018-01-10 04:30:48 | 2018-01-04 06:55:48 | +---+--------------------+---------------------+

I want select location from user_location table where updated_date should not be there in start_date and stopped_date.start_date and stopped dates are not fixed and contain more than 1 records

The result of above query should look like this:-

If I want to select locations On 2018-01-09

Result Of Above Query

+---+-----+-----+---------------------+ |id | lat | lon | updated_date | +---+-----+-----+---------------------+ | 1 |16.45|75.45|2018-01-09 12:50:57 | | 2 |16.43|75.35|2018-01-09 13:57:35 | | 3 |16.48|75.47|2018-01-09 14:59:30 | +---+-----+-----+---------------------+

0 Answers0