U
U
UkashEU2019-11-16 18:36:00
SQL
UkashEU, 2019-11-16 18:36:00

Display fields older than > X days?

SELECT * FROM `ibf_topics` WHERE `forum_id` = 51
- Displays all forum topics with ID 51.
There is also a last_post column with a value of 1568791098 ( Wed 18 Sept 2019 10:18:18 (MSK) )
How to execute the query SQL to print all values ​​since last_post older than 60 days?
In general, you need to pull out topics in which there is no answer for the past 60 days, for subsequent transfer.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Lazy @BojackHorseman, 2019-11-16
@UkashEU

on a muscle

...
WHERE `last_post` < (unix_timestamp() - 3600 * 24 * 60 )

R
Rikcon, 2019-11-16
@Rikcon

here, you just need to do date_sub(curdate(),interval 60 day) - it will be datetime 60 days ago, and then
https://stackoverflow.com/questions/11133760/mysql...
You need to convert this datetime to timestamp, and there is already a banal check for one number no more than another.
I will not write a request for you, if you have any more questions, write here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question