So I have an existing Mysql query that is pretty intense as-is which goes something like:
SELECT CURRENT.*, PROGRAMS.NAME
FROM CURRENT
LEFT JOIN PROGRAMS ON CURRENT.PID = PROGRAMS.ID
ORDER BY PID ASC
Now, I want to use this query to do something else since I’m already hitting my database. I have a third table called “TIMEWINDOWS”, how would I use this query to return a set of tinyint (0 or 1) based on whether or not it’s between the Start_Time and End_Time along with all the other stuff already in my query?
Thanks a lot for the help.
The TimeWindows table has the following stuff:
ID int(11) PK
PID int(11) <-- Can join on this from any of the other tables.
ALL_DAY tinyint(1)
START_DATE date
END_DATE date
EARLIEST time
LATEST time
NOTICE int(11)
LATEST time
MAX int(11)
MIN int(11)
PROBABLE_START time
PROBABLE_END time
I want to check if it’s between start & end date, and return a bool if it is but I can’t seem to find a way to do so, can anyone help?
1 Answer