--Pivot table in sql
-- Pivot means you can display your vertical data into horizontally view (Note: it is used to view data only)--I think no need to explain just look example you will understand easily
--I have created simple example just copy past and run and see the difference and learn
--Here i have taken temp table and have inserted value into that . (You can play with your table also)
Declare @Student table(ID int, name varchar(10),Subject varchar(10), Marks int) -- @student is name of table
-- Insert values into @student table
insert into @Student values(101, 'ashok' , 'Maths',86),(101, 'ashok' , 'English',80),(101, 'ashok' , 'Science',80)

Saineshwar BageriPosted Feb 25, 2014, 11:22 PM
Nice one but Show out put also