Selecting and ordering data over multiple date rangesby peppiv (Curate)
|on Feb 07, 2003 at 15:34 UTC||Need Help??|
peppiv has asked for the
wisdom of the Perl Monks concerning the following question:
Got a doozy here. Part of the web reporting that Mgmt wants includes a running list of subscribers to our newsletter.
Background - I'm running Linux/Apache with FreeTDS/DBD::Sybase connecting to a Win2K box with SQL Server 7.0.
Every time someone subscribes they put in their address (specifically the State they live in) and the DB includes the date/time they subscribed.
Col 1 - John Smith Col 2 - NY Col 3 - 02/06/2003
I print to screen the top ten states and the count of subscribers in descending order.
Here's how I do it.
But how can I do this for the following months?
Here's what I need it to look like.
I need the order to be listed by the current month and still show what happened the previous months.
Can anyone help point me in the right direction?