Reputation: 63
Hi guys I have this query
UPDATE `account`.`account` SET `status` = 'Admin'
WHERE `status` = 'User' AND `last_online`
What I'd like to do is to check the last time online and be sure that 10 minutes had passed since last time online . Any idea? Thanks
Upvotes: 0
Views: 76
Reputation: 13465
Try this::
UPDATE `account`.`account` SET `status` = 'Admin'
WHERE `status` = 'User' AND TIMEDIFF(now(),`last_online`)>600
Upvotes: 2
Reputation: 10250
Query the database for the most recent activity and then compare the dates before choosing to insert.
Upvotes: 0