MySQL - Select data in current day, week, month or year
Posted: 29 Dec 2014, 09:24
I facing a problem about a select query in MySQL.
I have table user, It contains id_user, username and user_time. And user_time is a Date-Time for user when register, the properties is Timestamp so the output is like this:
I use this query for display data per year.
The query works but just giving an empty row. It's not only year but also give empty rows on day, week, or month.
Any answer?
I have table user, It contains id_user, username and user_time. And user_time is a Date-Time for user when register, the properties is Timestamp so the output is like this:
Code: Select all
User A | user_time > 2014-12-22 10:10:10
Code: Select all
SELECT * FROM user WHERE user_time = YEAR(NOW());
Any answer?