Initially I was working with two query, One was returning Student's marks, second was returning Grand Total Marks.
Now I decided to Union these two queries but my Grand Total row is appearing at top, which I want at bottom, I tried changing the sequencing of two, but no impact on result. Please suggest, my query is:
SELECT AISECTRESULT_Schemes.SUBNO,
AISECTRESULT_Schemes.SUBJECT,
AISECTRESULT_Schemes.CE_TotalMarks,
AISECTRESULT_ExamMarksData.TotalMarksObt_C,
AISECTRESULT_Schemes.TE_TotalMarks,
AISECTRESULT_ExamMarksData.TotalMarksObt,
MAXMARKS,
AISECTRESULT_ExamMarksData.OverAllMarks
FROM AISECTRESULT_Schemes
INNER JOIN AISECTRESULT_ExamMarksData
ON AISECTRESULT_Schemes.[EXAMSCHEME ID] = AISECTRESULT_ExamMarksData.EXAMSCHEMEID
WHERE (AISECTRESULT_ExamMarksData.REGISTRATIONID = '201192145')
UNION
SELECT ''AS SUBNO,
''AS SUBJECT,
SUM(AISECTRESULT_Schemes.CE_TotalMarks)CE_TotalMarks,
SUM(AISECTRESULT_ExamMarksData.TotalMarksObt_C)TotalMarksObt_C,
SUM(AISECTRESULT_Schemes.TE_TotalMarks)TE_TotalMarks,
SUM(AISECTRESULT_ExamMarksData.TotalMarksObt)TotalMarksObt,
SUM(AISECTRESULT_Schemes.MAXMARKS)MAXMARKS,
SUM(AISECTRESULT_ExamMarksData.OverAllMarks)OverAllMarks
FROM AISECTRESULT_Schemes
INNER JOIN AISECTRESULT_ExamMarksData
ON AISECTRESULT_Schemes.[EXAMSCHEME ID] = AISECTRESULT_ExamMarksData.EXAMSCHEMEID
WHERE (AISECTRESULT_ExamMarksData.REGISTRATIONID = '201192145')