Jake
Jake

Reputation: 3486

MYSQL online members in past 30 days

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

Answers (2)

fatnjazzy
fatnjazzy

Reputation: 6152

SELECT * FROM table WHERE lastOnline > (UNIX_TIMESTAMP(NOW()) - (3600*24*30));

Upvotes: 0

Nicola Cossu
Nicola Cossu

Reputation: 56357

select 
count(*) as users 
from table 
where from_unixtime(lastonline) >= now() - interval 30 day

Upvotes: 1

Related Questions