Evaluate mysql date range
NickName:cent89 Ask DateTime:2015-09-02T16:35:50

Evaluate mysql date range

I have a mysql table with some date ranges, for example:

start: 2015-09-10 end: 2015-09-10

Now, I have to check if another date range is inside the start-end date, even if only for some days.

  1. 2015-09-02 -> 2015-09-03 is outside the range;
  2. 2015-09-05 -> 2015-09-11 is inside the range;
  3. 2015-09-11 -> 2015-09-12 is inside the range;
  4. ...

I have these query, it works for case 1 and 2:

SELECT * FROM prenotazione WHERE id_stanza=1 AND (start BETWEEN '2015-09-11' AND '2015-09-12' and end BETWEEN '2015-09-11' AND '2015-09-12' )

For the case 3, the query returns no result, even id the given date are inside the range. Can you help me?

Copyright Notice:Content Author:「cent89」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/32348326/evaluate-mysql-date-range

More about “Evaluate mysql date range” related questions

Evaluate mysql date range

I have a mysql table with some date ranges, for example: start: 2015-09-10 end: 2015-09-10 Now, I have to check if another date range is inside the start-end date, even if only for some days. 20...

Show Detail

php mysql double date range

I am working on an event callendar and am having trouble finding a mysql query that selects my events within a given range. My events have start/end dates and so do my ranges (Months). I have trie...

Show Detail

MySQL Range Partitioning DATE() Not Working

I'm working on the optimization of MySQL query these days, one of the issues I've encountered is DATE() maybe not working for the table partitioned by date range. Here is the sample table: CREATE ...

Show Detail

Working with mysql date range

I am attempting to retrieve records from a mysql database based on a specific date range using the following query: $query = "SELECT * FROM data WHERE" . "date between '11/02/13' and '1...

Show Detail

MySql Query For Date Range in PHP

I have a MySql database that uses a timestamp field to track when the entry was inserted. Now I want to query the table for entries by a date range. I would prefer to use MySql to extract the rec...

Show Detail

The result of Evaluate (on a range) is incorrect

I am using this line of code and it works correctly Range("S2:S7").Formula = "=LEN(E2)" But, when I changed it to Evaluate , I got incorrect result of Len function (always = 9) ...

Show Detail

PHP mysql select date range

I have a invoice type form submission and every submission has a date so I have created a varcha date field in mysql database to save the time.Time format is like '2011-06-26'.Now I need to select a

Show Detail

Get Date Range From MySQL database

How can I get the date range like month and year of the data from MySQL database? For example if a table in database has the record of data from Feb 2012 to Jan 2013, how can I get to know the date...

Show Detail

mysql DATE range BETWEEN Query

I have some very odd behaviour from a MySQL query in my C# application which is pulling rows from a Table called project_info. It should retrieve all the Rows which Equal the Customer's Name, and the

Show Detail

Trim range with evaluate

I'm trying to speed up trimming a data sheet with about 5000 rows and 12 columns. I used a For Each Loop that works but sets Excel into "not responding" for a while before it is done. I researche...

Show Detail