Link to home
Start Free TrialLog in
Avatar of Larry Brister
Larry BristerFlag for United States of America

asked on

SQL Pivot statement

Is there any way the attached select can be done where I just grab all values in the disqualifyReason columns without having to actually declare them?

I don't want to have to put the...
[Qualified], [DebtConsol], [Disability],....etc...

unless I have to


SELECT rep, [Qualified], [DebtConsol], [Disability], [Loans], [Lottery], [needLegal] , [PreSettlement], [Restitution], [RetVet], [SocialSecurity], [WorkComp], [ExistsTransferred] 
into #tempData FROM CALLDETAIL.dbo.inboundCalls T
 pivot (COUNT(disqualifyReason) 
			FOR disqualifyReason IN ([Qualified], [DebtConsol], [Disability], [Loans], [Lottery], [needLegal], [PreSettlement], [Restitution], [RetVet], [SocialSecurity], [WorkComp], [ExistsTransferred])) pvt;

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Larry Brister

ASKER

Perfect...thanks