I need a query to find all records with a timestamp greater than 120 days.
select * from table where timestamp > 120 days
How would i compare the timestamp to 120 days? Ive only compared dates which seems to be a lot easier.
If your table name is "table_name" and timestamp column is "date_col" then you can use below query:
select * from table_name where date_col > DATE_SUB(CURDATE(), INTERVAL 120 DAY);
1.4m articles
1.4m replys
5 comments
57.0k users