HI All,
I need display columns as rows androws as columns in gridview like
EX:I have a stored procedure like(select center,dept,sum(Amount) from table where distno=19);(note:I am selecting those columns from multiple tables using joins) wrote that single query for understanding.....
so when i bind it dynamically the gridview looks
centre dept amount
hyd IT 2500
hyd cse 2600
hyd ECE 2700
bangl IT 2200
bangl CSE 2300
bang ECE 2500 ----like so on......as i have some no of centers and dept(based on selected distrtict center and dept varies)
I want to bind gridview like
centre IT CSE ECE
hyd 2500 2600 2700
bang 2700 2200 2300
...
How can i achieve this??(hope the question is understandable)
Thanks..
Sanjeeb LenkaPosted Jun 12, 2013, 1:32 PM
http://www.oracle-base.com/articles/11g/pivot-and-unpivot-operators-11gr1.php
Avinash MaddyPosted Jun 12, 2013, 7:54 AM
Jignesh TrivediPosted Jun 12, 2013, 12:55 AM
hi,
As per me, this can be done by using pivot table in SQL server
Please refer following link it might help you to resolve your problem.
http://msdn.microsoft.com/en-us/library/ms177410(v=sql.105).aspx
http://blogs.msdn.com/b/spike/archive/2009/03/03/pivot-tables-in-sql-server-a-simple-sample.aspx