1
stefan88
need help with SELECT query ...
  • 2006/2/13 12:23

  • stefan88

  • Community Support Member

  • Posts: 1086

  • Since: 2004/9/20


Hi

Could someone help me with a SELECT query that will give the maximum number of user registrations for a single day between (date1) and (date2).

What will be beter - to use only SQL query or leave part of the job for PHP ...

Thanks
..

2
Dave_L
Re: need help with SELECT query ...
  • 2006/2/13 13:45

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


[XOOPS 2.2.x]

SELECT COUNT(*) AS countFROM_UNIXTIME(user_regdate,'%Y-%m-%d') AS date
FROM xoops_user_profile
WHERE user_regdate BETWEEN UNIX_TIMESTAMP
('2005-11-01') AND UNIX_TIMESTAMP('2006-01-01')
GROUP BY date
ORDER BY count DESC
LIMIT 1


Replace "xoops" by your table prefix, and change the dates to the desired range.

If you're doing this manually, a query is ok.

If you're building it into XOOPS, it would be better to use the XoopsMemberHandler class, so that your code isn't dependent on the database structure.

3
stefan88
Re: need help with SELECT query ...
  • 2006/2/13 14:34

  • stefan88

  • Community Support Member

  • Posts: 1086

  • Since: 2004/9/20


Thank you very much!

..

Login

Who's Online

265 user(s) are online (146 user(s) are browsing Support Forums)


Members: 0


Guests: 265


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits