I have two tables:
Concert:
id | name | date
1 | aaa | 2016-02-14
2 | bbb | 2016-02-15
Times:
id | concert_id | time
1 | 1 | 10:00:00
2 | 1 | 16:00:00
3 | 1 | 21:00:00
4 | 2 | 10:00:00
5 | 2 | 15:00:00
6 | 2 | 21:00:00
I would like get concerts by day. For example for "2016-02-14":
SELECT * FROM Concert as c LEFT JOIN Times as t ON c.id = t.concert_id WHERE c.date = '2016-02-14' AND t.time > CURTIME()
This working ok, return only Times with ID 3, but for:
SELECT * FROM Concert as c LEFT JOIN Times as t ON c.id = t.concert_id WHERE c.date = '2016-02-15' AND t.time > CURTIME()
also returns last ID (6). Should be all times (4, 5, 6), because this is next day.
How can I compare CURTIME with CURDATE for my example? IF expression? But how?