Another SQL Query

Hi all i have the following query, but i now need it grouped into weeks and not months,

Please help

SELECT     TOP (100) PERCENT DATENAME(month, createdon) + DATENAME(year, createdon) AS Month, projcode, result, COUNT(*) AS Expr2, createdon
FROM         dbo.dmsproj
WHERE     (createdon >= DATEADD(MONTH, - 12, CONVERT(datetime, CONVERT(varchar(8), GETDATE(), 120) + '01', 120)))
GROUP BY createdon, DATENAME(month, createdon) + DATENAME(year, createdon), projcode, result
pepps11976Asked:
Who is Participating?
 
Ephraim WangoyaConnect With a Mentor Commented:

Use
DATENAME(week, createdon)

But remember this will just give you the week number of the year
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.