MySQL query to select distinct rows based on date range overlapping
问题 Let's say we have a table (table1) in which we store 4 values (user_id, name, start_date, end_date) table1 ------------------------------------------------ id user_id name start_date end_date ------------------------------------------------ 1 1 john 2016-04-02 2016-04-03 2 2 steve 2016-04-06 2016-04-06 3 3 sarah 2016-04-03 2016-04-03 4 1 john 2016-04-12 2016-04-15 I then enter a start_date of 2016-04-03 and end_date of 2016-04-03 to see if any of the users are available to be scheduled for a