Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8314319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:46:40+00:00 2026-06-08T20:46:40+00:00

Initially I was working with two query, One was returning Student’s marks, second was

  • 0

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')

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T20:46:43+00:00Added an answer on June 8, 2026 at 8:46 pm

    You need an ORDER BY on your query. This should do it:

    SELECT  SUBNO, 
            SUBJECT, 
            CE_TotalMarks, 
            TotalMarksObt_C, 
            TE_TotalMarks, 
            TotalMarksObt,
            MAXMARKS, 
            OverAllMark
    FROM (  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,
                    1 ColOrder
            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_Exa![enter image description here][1]mMarksData.OverAllMarks)OverAllMarks,
                    2
            FROM AISECTRESULT_Schemes 
            INNER JOIN AISECTRESULT_ExamMarksData 
            ON AISECTRESULT_Schemes.[EXAMSCHEME ID] = AISECTRESULT_ExamMarksData.EXAMSCHEMEID 
            WHERE AISECTRESULT_ExamMarksData.REGISTRATIONID = '201192145') AS Data
    ORDER BY ColOrder
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have used FrameLayout in which I have used two LinearLayouts. The second one
I've been working for around two weeks now on building some detailed reporting options
Initially I was working on Android in Eclipse and everything went fine. But two
I am having problem using mvc:resources in spring 3.1 configuration. Initially i was working
I'm working on a project that initially used Subversion, but the remote repository was
I'm working with an NSImage which comes from a PDF. When I initially create
I am working on a GridView in Asp.Net. When initially a the Page Loads,
I have two spinners one named cuisine and other area. I m calling the
I want to save Json into two variables so that I can manipulate one,
Right now, I have a working HTML template system written in OCaml. The general

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.