Reputation: 13
In a mysql table for a date column(login_time), i need to get the logins for
last 30 days, last 60 days.
Is there any way to do that?
Thanks.
Upvotes: 1
Views: 152
Reputation: 92792
this will give you the rows from the table where login_time is within the last 60 days:
SELECT * FROM table WHERE login_time >= SUBDATE(CURDATE(),INTERVAL 60 DAY)
similarly with 30 days.
Upvotes: 4