So I have 2 tables caring and client, like this

```
client {
  id,
  name
}

caring {
  id,
  startDate,
  endDate,
  clientId
}

```

I need to get all clients that have at least one day available between two provided dates, you can see my screenshot as reference.

[![Screenshot](https://i.stack.imgur.com/7becP.png)](https://i.stack.imgur.com/7becP.png)

In screenshot I have two clients, and I need to return both of them. As you can see, the first client have three free days (21.5.-23.5.) between provided period (16.5.-29.5.) and the second client have not any caring periods.

So far i have tried something like this

```
SELECT * FROM client cl
WHERE cl.id NOT IN (SELECT clientId FROM caring 
WHERE endDate >= CURDATE() AND endDate <= DATE_ADD(CURDATE(), INTERVAL 14 DAY))

```

This one return only clients that don't have carings at all. That is partially what I need because this query don't cover first client from my screenshot. Then I tried query bellow.

```
SELECT ca.startDate, ca.endDate, cl.firstName, cl.lastName
FROM caring ca
LEFT JOIN client cl on cl.id = ca.clientId
WHERE ca.startDate NOT IN (
    SELECT endDate
    FROM caring 
) AND ca.startDate <= '2017-05-29' AND ca.endDate >= '2017-05-16'

```

But im not getting desired results.

Any idea how I can achieve this, thx in advance!