SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Dynamic Pivot for multiple columns
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

GirishKumarSharma
Starting Member

10 Posts

Posted - 07/17/2013 :  09:14:39  Show Profile  Reply with Quote
Hi,

I know, it is bad etiquette to post the same question link in other forum, but here it is my question link :

http://www.sqlservercentral.com/Forums/Topic1474579-8-1.aspx

I am sorry, to post the question in such a way, but if anyone can please help me by looking the above link, I shall be thankful for your help.

Just because I think in that forum, there is less activity, so I am trying here.

Thanks and Regards
Girish Sharma

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 07/17/2013 :  11:31:03  Show Profile  Reply with Quote


SELECT code,
MAX(CASE WHEN department = 'AKD' THEN netqty END) AS NetQty_AKD,
MAX(CASE WHEN department = 'AKD' THEN netmrp END) AS NetMrp_AKD,
MAX(CASE WHEN department = 'MRI' THEN netqty END) AS NetQty_MRI,
MAX(CASE WHEN department = 'MRI' THEN netmrp END) AS NetMrp_MRI,
MAX(CASE WHEN department = 'PHYSIOTHERAPY' THEN netqty END) AS NetQty_PHYSIOTERAPY,
MAX(CASE WHEN department = 'PHYSIOTHERAPY' THEN netmrp END) AS NetMrp_PHYSIOTERAPY,
MAX(CASE WHEN department = 'SONO' THEN netqty END) AS NetQty_SONO,
MAX(CASE WHEN department = 'SONO' THEN netmrp END) AS NetMrp_SONO
FROM consumption
GROUP BY code


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22755 Posts

Posted - 07/23/2013 :  05:09:21  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
Also refer this post
http://beyondrelational.com/modules/2/blogs/70/posts/10791/dynamic-crosstab-with-multiple-pivot-columns.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000