0

I have a join_table as follows for a single person with id = 123.

join_time

id  subject join_date
123 MATH    03-MAY-19
123 MATH    12-MAR-15
123 CS      05-JUN-12
123 CS      24-JUL-12
123 CS      27-JUN-14
123 HIST    18-AUG-14
123 HIST    19-DEC-12
123 SCI     20-MAY-02
123 SCI     26-JUL-93

My oracle sql output should be 1 per subject with the latest joining date and also the subject should be formatted as below:

id  subject                 join_date
123 Maths                   03-MAY-19
123 Computer Science        27-JUN-14
123 History                 18-AUG-14
123 Science                 20-MAY-02

suggestions pls?

1 Answer 1

2

Seems you need aggregation function and group by

    select id, subject, max(join_date)
    from my_table 
    group by id, subject
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.