troubleshooting Question

Help Creating Pivot Table In SQL 2005

Avatar of dleads
dleads asked on
Microsoft SQL ServerMicrosoft SQL Server 2005
14 Comments2 Solutions1356 ViewsLast Modified:
Hello.  Can someone tell me how I could turn this sql statement into a pivot table that
uses the Attorney, SumOfMatters, ...List of Trade Types... for column headers
and the row to have the Attorney and sumofmatters by [trade type]?

SELECT     TOP (100) PERCENT ATTORNEY, COUNT([MATTER NUMBER]) AS [SumOfMatters], [trade type]
FROM         dbo.MATTERS
WHERE     ([SELLER NAME] <> N'[general]') AND ([BUYER NAME] <> N'[general]') AND ([Closed Matters] <> 1) AND ([CLIENT NUMBER] <> 888) AND
                      ([CLIENT NUMBER] <> 200)
GROUP BY ATTORNEY, [trade type]
HAVING      (ATTORNEY IS NOT NULL)

Thanks in advance!
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 2 Answers and 14 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 2 Answers and 14 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