Reputation: 17
Hello I tried to update a row in table if somebody is offline more than 1 minute, and set LoggedIn then as 0, but my SQL query doesn't work, what I do wrong?
"UPDATE acc SET LoggedIn='0' WHERE LastTimeActive<(NOW(), INTERVAL 1 MINUTE)";
Upvotes: 0
Views: 56
Reputation: 1270011
You are missing date_sub()
:
UPDATE acc
SET LoggedIn = '0'
WHERE LastTimeActive < date_sub(NOW(), INTERVAL 1 MINUTE);
Upvotes: 1