I've got a following database entry:
id date start_time
1 2015-12-25 08:00:00
2 2015-12-30 08:00:00
3 2015-12-30 09:00:00
Now I just want to select the date of those entries where both start_time entries 08:00:00 and 09:00:00 exists.
I tried to use this SQL query:
$sqlquery = mysqli_query($myconnection,"SELECT date
FROM mytable
WHERE start_time LIKE '08:00:00'
AND '09:00:00'") or die ("crashed");
But it returns me both dates 2015-12-25 and 2015-12-30. It should only return 2015-12-30 because for this date 08:00:00 and 09:00:00 exists.
I want to select those dates which have an entry for 08:00:00 and 09:00:00 too.
It should not select dates with only an entry for 08:00:00 but none for 09:00:00 and also not those which have an entry for 09:00:00 but none for 08:00:00.
start_time = '08:00:00' OR start_time = '09:00:00'OR dates where the time instart_timeis anything BETWEEN08:00:00 and 09:00:00This may sound like a subtile difference but it is not08:00:00or09:00:00?? Not08:00:01or09:00:02