Intro: I have an database with table which contains column with hours, for example
08:30:00
08:45:00
09:30:00
12:20:00
...
18:00:00
the datatype in this column is “time”.
Question: is it possible with SQL to select all hours [ for eg. 10:00:00, 10:30:00, 11:00:00 etc. ] from range 08:00:00 to 18:00:00, which are not on the list?
edit:
Well, after thinking it out, the solution which You [ thanks! ] is not entirely perfect [ well it is perfect with details I gave u 🙂 ]. My application is allowing users to make an appointments which takes half an hour [ in this version of app ]. The column with time I gave u in my first topic is quite optimistic, because I didn’t put cover meetings for hours such as 11:45:00 or 13:05:00, which will end at 12:15:00 and 13:35:00, so I don’t really know from the top which hours I would be able to put in this extra table.
First, create a table
T_REFwith a columnCOL_HRwith dates that haveall the hours you want to report if not found in the original table.
In MYSQL doing something like this should work
This will get and compare only the hours and report the ones that are not
in your table (
ORIG_TABLE).