SELECT * FROM users WHERE TO_SECONDS(NOW())-TO_SECONDS(TS) <= 604800
TS is timestamp column.
604800 is the time in seconds 7 days.
This query runs perfectly on locally on windows but when I upload it to the Linux server it stops working.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
TO_SECONDS only exists in SQL version >= 5.5, check what version you have on linux. Most likly the version with your distro is out of date.
A solution without upgrading is here:
Emulating TO_SECONDS() in older versions of MySQL (<5.5.0)