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

  • SEARCH
  • Home
  • 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 7891637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:40:09+00:00 2026-06-03T06:40:09+00:00

I am trying to do something like this, and I’m not sure if it’s

  • 0

I am trying to do something like this, and I’m not sure if it’s possible using a simple GROUP BY:

SELECT GD.GradebookDetailId, G.SubjectCode, G.Description, G.UnitsAcademic, G.UnitsNonAcademic, 
GD.Grade, GD.Remarks, G.FacultyName, STR_TO_DATE(G.DateApproved, '%m/%d/%Y %h:%i:%s') AS 'DateAproved'

FROM gradebookdetail GD 
INNER JOIN gradebook G ON GD.GradebookId=G.GradebookId 
WHERE G.DateApproved IS NOT NULL AND G.GradebookType='final' AND StudentIdNumber='2012-12345'

GROUP BY ???????
ORDER BY G.SubjectCode ASC

So when I have a table like this:

Student: 2012-12345

SubjectCode | Grade | DateApproved
SUBJ123 | 2.00 | 1/4/2012
SUBJ123 | 1.75 | 1/5/2012
SUBJ987 | 1.50 | 1/5/2012

It will should look like this:

Student: 2012-12345

SubjectCode | Grade | DateApproved
SUBJ123 | 1.75 | 1/5/2012
SUBJ987 | 1.50 | 1/5/2012

EDIT: Here’s the solution:

SELECT 
    GD.GradebookDetailId, 
    G.SubjectCode, 
    G.Description, 
    G.UnitsAcademic, 
    G.UnitsNonAcademic, 
    GD.Grade, 
    GD.Remarks, 
    G.FacultyName, 
    STR_TO_DATE(G.DateApproved, '%m/%d/%Y %h:%i:%s') AS 'DateAproved'
FROM 
    gradebookdetail GD INNER JOIN 
    gradebook G ON GD.GradebookId=G.GradebookId 
WHERE 
    G.DateApproved IS NOT NULL AND 
    G.GradebookType='final' AND 
    StudentIdNumber='2011-10172' AND 
    NOT EXISTS (
        SELECT 1 FROM gradebook G2 INNER JOIN gradebookdetail GD2 ON G2.GradebookId=GD2.GradebookId
        WHERE 
            G2.GradebookType = 'final' AND 
            G2.DateApproved IS NOT NULL AND 
            GD2.StudentIdNumber = GD.StudentIdNumber AND 
            G2.SubjectCode = G.SubjectCode AND
            G2.DateApproved > G.DateApproved
    )
ORDER BY G.SubjectCode ASC
  • 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-03T06:40:11+00:00Added an answer on June 3, 2026 at 6:40 am

    I think this query will do what you want, but I haven’t tested it. So let me know if something is wrong with it.

    SELECT 
        GD.GradebookDetailId, 
        G.SubjectCode, 
        G.Description, 
        G.UnitsAcademic, 
        G.UnitsNonAcademic, 
        GD.Grade, 
        GD.Remarks, 
        G.FacultyName, 
        STR_TO_DATE(G.DateApproved, '%m/%d/%Y %h:%i:%s') AS 'DateAproved'
    FROM 
        gradebookdetail GD INNER JOIN 
        gradebook G ON GD.GradebookId=G.GradebookId 
    WHERE 
        G.DateApproved IS NOT NULL AND 
        G.GradebookType='final' AND 
        StudentIdNumber='2012-12345' AND 
        NOT EXISTS (
            SELECT 1 FROM gradebook G2 
            WHERE 
                G2.GradebookType = 'final' AND 
                G2.DateApproved IS NOT NULL AND 
                G2.StudentIdNumber = G.StudentIdNumber AND 
                G2.StudentCode = G.SubjectCode AND
                G2.DateApproved > G.DateApproved
        )
    ORDER BY G.SubjectCode ASC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying something like this, but this example does not work. jsObj = {};
I'm trying to do something like this: SELECT MAX( ADDDATE(expirationdate, INTERVAL 1 YEAR), ADDDATE(now(),
I'm trying something like this but it does not work. Am I doing something
I'm trying something like this: [ServiceContract ( CallbackContract = typeof (CallbackContract_1), CallbackContract = typeof
I'm trying to do something like this in Java: public static <T> T foo()
I'm trying to do something like this... <Style x:Key=TwoByTwoGridStyle TargetType=Grid> <Setter Property=Grid.RowDefinitions> <Setter.Value> <ControlTemplate>
I'm trying to do something like this in C++: if(){ int a; } else
I'm trying to replace something like this: NSSomeFunction(@some var, @another one) With: NSSomeOhterFunction(@some var)
I'm trying to do something like this post but with Excel VBA. I would
I am trying to do something like this: property = 'name' value = Thing()

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.