You could try a query like the following one if classid does not matter.
SELECT [English], [Hindi],[Telugu],[Drawing]
FROM
(
SELECT ROW_NUMBER() OVER (PARTITION BY SubjectId ORDER BY PaperName) AS rownum, SubjectId, PaperName
FROM T
GROUP BY SubjectId, PaperName
)AS base
PIVOT
( MAX(PaperName) FOR SubjectId IN ([English], [Hindi],[Telugu],[Drawing])) AS pvt;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.