If this is SQL Server, than the GROUP BY has to match the un-aggregated
SELECT columns, so it would need to be something like:
SELECT COUNT(intMemberID) AS NewMembers,
DATENAME(mm, dteAdded) + '-' + DATENAME(yyyy, dteAdded) AS Month
FROM TABLE
GROUP BY DATENAME(mm, dteAdded) + '-' + DATENAME(yyyy, dteAdded)
Not sure if that's what you're asking.
----------------------------------------
From: "Monique Boea" <[email protected]>
Sent: Wednesday, November 03, 2010 2:24 PM
To: "cf-talk" <[email protected]>
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:338804
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm