Neha May 24th, 2016 CodeSELECT max (MARKS ) FROM sp_report WHERE MARKS IN ( SELECT TOP 2 * FROM sp_report ORDER BY MARKS DESC)
sandip.daptare Jun 6th, 2016 CodeSELECT SID, Max(Marksrec) FROM (SELECT Sid, maths,chems,phys,engi FROM Marks) AS st Unpivot (Marksrec FOR MARKSNO IN( maths,chems,phys,engi)) AS ddd GROUP BY SID
Paresh Jun 24th, 2016 Code SELECT sid, Max(Marks) AS highest_marks FROM sp_report Unpivot (Marks FOR value IN( maths,chem,phy,engl)) AS Score GROUP BY sid
Query to Get Highest Marks Output
sid maths chem phy engl
1 33 45 54 48
2 55 32 50 37
3 10 20 30 40
The required o/p is (SQL QUERY TO GET THE BELOW O/P)
sid highest_marks
1 54
2 55
3 40
Related Answered Questions
Related Open Questions