Searching for different time periods...

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
jkashu
Forum Commoner
Posts: 45
Joined: Tue Jan 30, 2007 12:00 pm

Searching for different time periods...

Post by jkashu »

This will return signups today... How do I modify the last line to return results for this week, this month, and this year??

Code: Select all

SELECT 
SUM(amount) AS amountR,
COUNT(amount) AS salesR
FROM signups
WHERE affiliateID = '$affiliateID' AND userID IN (SELECT
                       userID
                       FROM users
                       WHERE signupdate = CURDATE())

Thanks!
Post Reply