0

MySQL database, I have a table which contains some column. First column is datatime type, like "2016-03-01 08:00:00", "2016-03-02 08:00:00".

What should i do to get everyday's 8 AM. from this table?

1
  • 1
    Hi there, welcome to the site. As it stands this question isn't very clear. Could you post some actual table definitions and some sample data along with expected output? You can edit your question to add additional information.
    – Tom V
    Apr 1, 2016 at 8:11

2 Answers 2

2

WHERE TIME(dt) = '08:00:00' is another way to filter on exactly 8am.

0
1

Assuming you want to return rows where the time is 8.00:

select       ...
from         a_table
where        hour(some_column) = 8
and          minute(some_column) = 0

http://www.w3resource.com/mysql/date-and-time-functions/mysql-hour-function.php http://www.techonthenet.com/mysql/functions/minute.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.