Your group by has to match your select in most cases...
Also, you are using reserved words in your query so that can mess stuff
up.

Try this instead...

Select count(intMemberID) as [NewMembers], dateName(mm, [dteAdded]) +
'-' + dateName(yyyy, [dteAdded]) as MTH
>From table
Group by dateName(mm, [dteAdded]) + '-' + dateName(yyyy, [dteAdded])

Steve


-----Original Message-----
From: Monique Boea [mailto:[email protected]] 
Sent: Wednesday, November 03, 2010 2:23 PM
To: cf-talk
Subject: Group BY


How can I get this query to group by month?

select count(intMemberID)as NewMembers, DATENAME(mm, dteAdded) + '-' +
DATENAME(yyyy, dteAdded) AS Month
FROM TABLE
GROUP BY Month(dteAdded)

When I ask on google everyone says to add:

*GROUP BY Year(SomeDate), Month(SomeDate)
*
but that doesn't work.

thanks




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338805
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to