troubleshooting Question

convert month number to name

Avatar of need_solution
need_solution asked on
Microsoft SQL Server
13 Comments1 Solution96 ViewsLast Modified:
I want to convert month number extracted from a date database field to Month name, but instead of getting different month names, i am just getting January.

with a as
(
select
         month(date field) as month, count (employee) cnt
from
         tablename
where
         paygrp = 'mycriteria'
group by
        month(date field)
)
select datename(month, a.month), a.cnt from a order by a.month
ASKER CERTIFIED SOLUTION
Éric Moreau
Senior .Net Consultant
Join our community to see this answer!
Unlock 1 Answer and 13 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros