PDA

View Full Version : Sql query for this month


grant.hayman
01-09-2008, 11:55 AM
I am trying to return the referrals for users from 'this month' but not sure where to start with joindate

SELECT count(userid) FROM user WHERE referrerid= '661' AND joindate = 'thismonth'

anyone know how I can do the this month part.

I am going to put this info into usercp so they can see where there upto with referrals for this month and run a competition for most referrals.

Thanks

--------------- Added 1199892735 at 1199892735 ---------------

used this and it seems to work great...

SELECT username FROM " . TABLE_PREFIX . "user WHERE referrerid='$usersid' AND MONTH(FROM_UNIXTIME(`joindate`))=MONTH(now())