Reputation: 3486
How can I get the number of members who have logged in, in the past 30 days using the column "lastOnline" in the format of 1274147184, from my database?
Upvotes: 0
Views: 74
Reputation: 6152
SELECT * FROM table WHERE lastOnline > (UNIX_TIMESTAMP(NOW()) - (3600*24*30));
Upvotes: 0
Reputation: 56357
select
count(*) as users
from table
where from_unixtime(lastonline) >= now() - interval 30 day
Upvotes: 1