I want to select the users that is oline on the last 25 minutes, how to do it?
I'm using NOW()-600
, i don't know how much seconds 600 is, it does not seem to be 600ms.
SELECT count(user_id) FROM users WHERE last_activity >= NOW()-600
You need to use the MySQL date methods. Probably in your case the DATE_SUB.
Something like the following maybe?
SELECT count(user_id) FROM users WHERE last_activity >= DATE_SUB(NOW(), INTERVAL 25 MINUTE)
Also this site about intervals might help you as well.