troubleshooting Question

Need Help with SQL Server Query

Avatar of Member_2_7967119
Member_2_7967119 asked on
Microsoft SQL ServerSQL
13 Comments1 Solution88 ViewsLast Modified:
I have a SQL table DEPARTMENT_REQUISITION_REGISTRATION

DEPT, YEAR, REQUEST_NUMBER

101, 2017, '10117-112233'
101, 2017, '10117-112244'
101, 2017, '10117-112255'
101, 2017, '10117-112266'
201,2017, '20117-211111'
201, 2017, '20117-311111'
201, 2017, '20117-411111'
201, 2017, '20117-511111'
101, 2018, '10118-112233'
101, 2018, '10218-112244'

Output needs to be

DEPARTMENT, 2017 ,2018

101, 4, 2
201, 3, 0

where 4 is the count() of the records fetched for department 101 in the year 2017 and similarly 2 is the count() for dept 101 in the year 2018. Please help me with the sQL server script. Thanks in advance
ASKER CERTIFIED SOLUTION
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