Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Oracle SQL: retrieve data from multiple tables. Help!!!

3815225Oct 18 2018 — edited Oct 21 2018

hi, i need to Retrieve data about students who receive the biggest stipend of their faculty; include faculty where

they study. i have this :

SELECT

ROWNUM AS Nr,

FACULTY_NAME,

NAME,

SURNAME,

STIPEND

FROM (

SELECT

faculty.faculty_name AS FACULTY_NAME,

student.name AS NAME,

student.surname AS SURNAME,

MAX(a.stipend) AS STIPEND

FROM

faculty,

student, (

SELECT

student.id_student,

MAX(money.stipend) AS stipend

FROM

student,

money

WHERE

student.id_student = money.student_id

GROUP BY student.id_student

HAVING MAX(money.stipend) >0

) a

WHERE

faculty.id_faculty = student.faculty_id AND

student.id_student = a.id_student

GROUP BY faculty.faculty_name, student.name, student.surname

);

I don't know why it shows all Stipends, i need only MAX stipend from Faculty.
1st picture is what i receive from my query. 2nd picture of all tables. Please help and tell me where i have a mistake

1.png

2.png

This post has been answered by Etbin on Oct 19 2018
Jump to Answer
Comments
Post Details
Added on Oct 18 2018
8 comments
2,314 views