Dear Friends ,
Any one can tell me how to create Pivot Table
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Jul 18, 2012, 3:15 AM
Please refer,
http://msdn.microsoft.com/en-us/library/ms177410%28v=sql.105%29.aspx
http://www.simple-talk.com/sql/t-sql-programming/creating-cross-tab-queries-and-pivot-tables-in-sql/
good article on Pivot in SQL server.
Rahul BhattPosted Jul 18, 2012, 2:50 AM
Your table has following field
empid
empname
gender
1
mohan
M
2
mohini
F
3
suraj
M
4
surya
M
5
ragini
F
6
rohini
F
7
raju
M
Empid, empname, gender
Now when you run simple query like
select * from tblGenderEMP
Now if you want to display row as coloum then you need to use PIVOT table
Display Cout how may Male and How many Female
M
F
4
3
Your Quey become as
SELECT [M], [F]
FROM
(
SELECT sp.gender,sp.empid
FROM tblGenderEMP as sp
) p
PIVOT
(
count (empid)
FOR gender
IN ([M], [F])
) AS pvt
Santhosh Kumar JayaramanPosted Jul 16, 2012, 2:15 AM
http://www.c-sharpcorner.com/Forums/Thread/175401/__cs_myImageUpload.aspx
Vilas GitePosted Jul 16, 2012, 2:15 AM
refer good one example by pinal Dave
http://blog.sqlauthority.com/2008/06/07/sql-server-pivot-and-unpivot-table-examples/
George ericPosted Jul 16, 2012, 2:14 AM
I will direct you to several links:
1, an article on codeproject.
2, Create Piovt table with 3rd tool.
And if you are an end-user, then please see http://chandoo.org/wp/2009/08/19/excel-pivot-tables-tutorial/.
Hope my links can solve your question.
Satyapriya NayakPosted Jul 16, 2012, 2:11 AM
Please refer the below links
http://blog.sqlauthority.com/2008/05/22/sql-server-pivot-table-example/
http://www.sqlmag.com/article/tsql3/create-pivoted-tables-in-3-steps
Thanks