Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Needed Sql Query Help

Author  Topic 

veenavidyakaran
Starting Member

1 Post

Posted - 2011-09-23 : 06:07:39
Can someone pls help out. I have a problem that i would need some assistance. i have a table as mentioned below

dealer_code dealer_name region month
A1001 Asha delhi 4/1/2011
A1002 Boby mumbai 5/1/2011
A1003 Vijay kolkata 6/1/2011
A1004 Rathi jodhpur 7/1/2011
A1005 Gita gujrat 8/1/2011

what i want accomplish is to have the above mentioned data in the below metioned format. Also the column dealer1 dealer2 dealer3..... changes dynamically

particulars dealer1 dealer2 dealer3 dealer4 dealer5
dealer_code A1001 A1002 A1003 A1004 A1005
dealer_name Asha Boby Vijay Rathi Gita
region delhi mumbai kolkata jodhpur gujrat
month 4/1/2011 5/1/2011 6/1/2011 7/1/2011 8/1/2011
Pls provide me the solution for the above problem
It's very urgent

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-23 : 06:35:51
see

http://sqlblogcasts.com/blogs/madhivanan/archive/2007/08/27/dynamic-crosstab-with-multiple-pivot-columns.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -