I think, i need the opposite of mysql’s BETWEEN function.
I have a given date (example ‘2013-09-14’) and a mysql-table filled with date ranges like:
date_from | date_to | someotherdata
2013-08-07 | 2013-08-29 | ...
2013-09-13 | 2013-09-16 | ...
2013-09-21 | 2013-09-27 | ...
(this is given, i cannot change the structure)
I want to select all entrys, where my given date is between date_from and date_to, but this does not work with BETWEEN 🙁
Any good ideas?
You can use
betweenlike that:SQLFiddle demo
There is no need for a column name before the
between. It can be a static date too.