Thread: SQL question
View Single Post
Old 10-01-2005, 10:12 PM  
daddy321
Registered User
 
Join Date: Jul 2005
Posts: 22
SQL question

Guys, I need some help here.

I am trying to find out today's singups. But, seems to me below statements give me last 24hour. I just wanna know how to get correct result for the current day.

Today's Signups:
SELECT COUNT(ID) FROM `Members` WHERE Status = 'Active' AND (TO_DAYS(NOW()) - TO_DAYS(registration)) <= 1;
SELECT COUNT(ID) FROM `Members` WHERE Status = 'Active' AND DATE_SUB(CURDATE(),INTERVAL 1 DAY) <= registration;

is this also correct way to find out logins for the current day, not last 24 hours?

Last 1 day's login
SELECT COUNT(ID) FROM `Members` WHERE Status = 'Active' AND (TO_DAYS(NOW()) - TO_DAYS(lastlogin)) <= 1;

Big thanks
Daddy
daddy321 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote