GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   SQL question (https://gfy.com/showthread.php?t=523122)

daddy321 10-01-2005 10:12 PM

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

sarettah 10-01-2005 10:21 PM

If the data is stored as a regular datetime field then:

SELECT COUNT(ID) FROM `Members` WHERE Status = 'Active' AND date_format(registration, '%m-%d-%y') ='10-01-05'

Should get you all the registrations for October 1.

Babaganoosh 10-01-2005 10:35 PM

Quote:

Originally Posted by sarettah
If the data is stored as a regular datetime field then:

SELECT COUNT(ID) FROM `Members` WHERE Status = 'Active' AND date_format(registration, '%m-%d-%y') ='10-01-05'

Should get you all the registrations for October 1.

The site in your sig cracked me up. :thumbsup

Good stuff. If I weren't a programmer myself I would hire you for everything. I am not a fucking designer however so I might hit you up still.

woj 10-01-2005 11:19 PM

Quote:

Originally Posted by Babaganoosh
The site in your sig cracked me up. :thumbsup

yup, lol, that site is fucking great :1orglaugh

sarettah 10-02-2005 06:42 AM

Thanx :)


All times are GMT -7. The time now is 09:26 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123