Skip to content
Advertisement

Display all data which are between these dates

So currently, I am trying to display a list of items which are not between date X and date Y. Let us assume that book_date_start = 2021-06-15, and bookdate_end = 2021-06-20

This is my current query:

So based on this

So basically as I was writing the above out, I realized that my query is WRONG, and since 2021-06-13 is less than 2021-06-15 (true), and 2021-06-20 is more than 2021-06-25 (true) also, that’s why it’s returning the record.

My question: How would I write query if I only want to return the record is the chosen date is between 2021-06-15 to 2021-06-20? (I’m pretty sure I’m overthinking this) but I’m SOO lost. I don’t need the full query or answer, I just hope someone can point me in slightly the right direction and I’ll be good to go.. Thanks all for reading.

Advertisement

Answer

Try the query as below.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement