Untested - but I know a similar thing works... have a feeling that MSSQL doesn't like 
grouping by aliases or something (there must be a reason why I did it like this... 
grey, hazy past :))

If Brett's works, Brett's looks better :)

- James

    SELECT CONVERT(nvarchar, YEAR(date_uploaded))) + RIGHT('00' + CONVERT(nvarchar, 
MONTH(date_uploaded))), 2) AS datetime, count(*) as doccount
    FROM         tablename
    GROUP BY path_info, CONVERT(nvarchar, YEAR(date_uploaded)) + RIGHT('00' + 
CONVERT(nvarchar, MONTH(date_uploaded)), 2)

-----Original Message-----
From: Brett Payne-Rhodes [mailto:[EMAIL PROTECTED]
Sent: Monday, September 08, 2003 3:07 PM
To: CFAussie Mailing List
Subject: [cfaussie] Re: SQL help please


Hi Steve,

Something like this...

<cfquery name="pageQuery" datasource="#request.DBName#">
   Select count(*) as docCount,
          year(activityDate) as activityYear,
          Month(activityDate) as activityMonth,
          activityDate
     from Activity
    Where activityDate > '2002-01-1'
      And activityDate < now()
    GROUP BY activityYear, activityMonth
    ORDER BY activityDate desc
</cfquery>

Should get you started...

Brett
B)

[EMAIL PROTECTED] wrote:
> Hey'all
>  
> I am trying to create some bar graphs of statistical data regarding the 
> number of documents uploaded to a website using CFGRAPH in CF5.
>  
> When the documents are uploaded (using simple http methods) the 
> "date_uploaded" is recorded in the MSSQL database as an ODBC datetime stamp.
>  
> How can i write a single query to count the number of documents uploaded 
> by month?
>  
> Thanks... Steve
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to 
> [EMAIL PROTECTED]
> 
> MX Downunder AsiaPac DevCon - http://mxdu.com/


-- 
Brett Payne-Rhodes
Eaglehawk Computing
t: +61 (0)8 9371-0471
f: +61 (0)8 9371-0470
m: +61 (0)414 371 047
e: [EMAIL PROTECTED]
w: www.ehc.net.au


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to