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.
| Author |
Topic |
|
pnpsql
Posting Yak Master
246 Posts |
Posted - 2011-12-24 : 00:44:47
|
| hi team, please tell me what is pivot table, and please give a example where this is use.challenge everything |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-24 : 00:54:37
|
are you asking about pivot table in excel or PIVOT in sql server?Both cases concept is same. You group results in a table based on one or more values in a field and show them in different columns ie effectively turning rows of tables to columns.As an example see this simplecaseStudentName Subject Marks-------------------------------------Stud1 Subj1 50Stud1 Subj2 27Stud1 Subj3 30Stud2 Subj2 48Stud2 Subj3 33Stud3 Subj1 42Stud3 Subj4 47Stud3 Subj2 34now if you've do the pivot based on subject field you will get result asStudentName Subj1 Subj2 Subj3 Subj4----------------------------------------------Stud1 50 27 30Stud2 48 33Stud3 42 34 47 ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
pnpsql
Posting Yak Master
246 Posts |
Posted - 2011-12-24 : 02:46:12
|
| thanks a lot. please write query for the same scenariochallenge everything |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
pnpsql
Posting Yak Master
246 Posts |
Posted - 2011-12-24 : 02:52:34
|
| that is too useful for me.challenge everything |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|