That was it. I found the solution
SELECT DATENAME(mm, article.Created) AS Month, DATENAME(yyyy, article.Created) AS Year, COUNT(*) AS Total FROM Articles AS article GROUP BY DATENAME(mm, article.Created), DATENAME(yyyy, article.Created) ORDER BY Month, Year DESC At the following link: http://stackoverflow.com/questions/45535/get-month-and-year-from-a-datetime-in-sql-server-2005 Thanks! On Wed, Nov 3, 2010 at 2:28 PM, Jason Fisher <ja...@wanax.com> wrote: > > 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" <moniqueb...@gmail.com> > Sent: Wednesday, November 03, 2010 2:24 PM > To: "cf-talk" <cf-talk@houseoffusion.com> > 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:338806 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm