user2761030
user2761030

Reputation: 1485

MySQL - DATETIME greater than given time regardless of date

I have a table which stores time data in the DATETIME format. I would like to build a query to return just the values after a give time (for example 15:00 - i.e. 3pm) for each day, not just for a given date.

Is this possible in MySQL. Does anyone have any examples?

Upvotes: 1

Views: 754

Answers (2)

O. Jones
O. Jones

Reputation: 108839

You can do this:

 WHERE TIME(column) >= '15:00:00' 

or even

 WHERE TIME(a.column) >= TIME(b.cutoff)

Upvotes: 2

Gordon Linoff
Gordon Linoff

Reputation: 1271151

You can use the hour() function:

where hour(col) >= 15

Upvotes: 3

Related Questions