hi,
I have a table like this,
pin subcode avg_marks
1 301 20
1 302 19
1 303 18
1 304 09
1 305 15
1 306 12
1 307 18
1 308 20
1 309 17
1 310 16
1 311 11
Now I want to have table as
pin 301 302 303 304 305 306 307 308 309 310 311
1 20 19 18 09 15 12 18 20 17 16 11
i tried to do this using pivot table. I can't do it. I am using sql server 2000.
Please help me.......

karthick kumarPosted Oct 7, 2010, 2:59 AM
I try out this using pivot. i am Considering a table named as Test.Replace your tablename.Here is the Selection
SELECT *
FROM
(SELECT PIN,Subcode,avg_marks
FROM Test) s
PIVOT
(
SUM(avg_marks)
FOR Subcode IN ([301],[302],[303],[304],[305],[306],[307],[308],[309],[310],[311])
) p
ORDER BY [PIN]
--if my answer helped u in anyway.Mark as answered
Koteswararao MallisettiPosted Oct 7, 2010, 2:42 AM
the data is insert into below table