I need to store a TV guide in MYSQL and I was thinking something like this:
channel_id day start_time end_time
AMC Breaking Bad:) Monday 19:00:00 20:30:00
Other Program Saturday 09:30:00 12:30:00
end_time and start_time are TIME fields and store HOURS.
My problem and questions is:
How can I get from MYSQL what programs are watching NOW()? I don’t know how to compare the hours. I done some test, but i get nothing.
Hope you understand my English!
Thanks Guys!
I think you are asking how I can get a list of programs that are on right now where NOW is greater than or equal to the start_time and less than the end_time. With those assumptions here is the SQL:
EDIT: As @Corbin notes, you will need to check the day.