SQL Statement - condition in state?
I have a table where each record contains a time represented by a hour column (int)
and a minute column (int)
. For example:
**records |hours| mins**
record1 | 15 | 30
record2 | 12 | 25
I want to write a statement that only displays records that are earlier than the current time. So far I have had:
SELECT...
WHERE hours >= hour(current_time)
AND
mins >= minute(current_time)
AND...
But that doesn't work because the hours and minutes must be greater than the current hours and minutes. How should I write so that if the hours are the same the minutes are compared?
+3
source to share