Reputation: 60
I have a table like this where I have classified two time Morning and Evening.
I want to retrieve row with input such as current time. For example,
SELECT name
FROM TimeMaster
WHERE start_at < '02:00:00' AND end_at > '02:00:00';
I am getting Morning row, but if I give other input I am not getting any rows.
But if I give other input such as..
SELECT name
FROM TimeMaster
WHERE start_at < '17:28:00' AND end_at > '17:28:00';
No rows are retrieved.
Upvotes: 1
Views: 52
Reputation: 1178
USE:
SELECT name FROM TimeMaster WHERE xinputime between start_at and end_at;
where xinputime
is your given random time which can be the current time or something you desire. And also change start_at
time from 00:00:00
to 11:59:59
and end_at
time from 12:00:00 to 23:59:59
Upvotes: 1