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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Satyapriya NayakRank #47 · 31.5K reputationPosted Jul 15, 2012, 10:11 PM EDT
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
George ericRank #9,604 · 204 reputationPosted Jul 15, 2012, 10:14 PM EDT
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.
Vilas GiteRank #951 · 2.1K reputationPosted Jul 15, 2012, 10:15 PM EDT
refer good one example by pinal Dave
http://blog.sqlauthority.com/2008/06/07/sql-server-pivot-and-unpivot-table-examples/
Santhosh Kumar JayaramanRank #563 · 4.3K reputationPosted Jul 15, 2012, 10:15 PM EDT
http://www.c-sharpcorner.com/Forums/Thread/175401/__cs_myImageUpload.aspx
Rahul Bhatt165 reputationPosted Jul 17, 2012, 10:50 PM EDT
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
Jignesh TrivediRank #16 · 50.3K reputationPosted Jul 17, 2012, 11:15 PM EDT
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.