I am working with two different tables, one contain student information like names , phones number and so an while another table contains the result of student for some courses. I want to select the maximum score from the result table and join it (match) with the name of the student that has the score from the other table that contain the student information
Asked
Active
Viewed 51 times
-2
-
[How do I ask and answer homework questions?](https://meta.stackoverflow.com/q/334822/3404097) [How much research effort is expected of Stack Overflow users?](https://meta.stackoverflow.com/q/261592/3404097) [ask] [Help] A question re how you are 1st stuck will be a duplicate. Please before considering posting read the manual/reference & google any error message & many clear, concise & precise phrasings of your question/problem/goal, with & without your particular names/strings/numbers, 'site:stackoverflow.com' & tags; read many answers. Please in code questions give a [mre]. Reflect research. – philipxy Apr 02 '22 at 00:07
-
Duplicate of [Fetch the row which has the Max value for a column](https://stackoverflow.com/q/121387/3404097) – philipxy Apr 02 '22 at 02:45
-
Please provide enough code so others can better understand or reproduce the problem. – Community Apr 02 '22 at 12:47
-
These few lines of codes will do the needful .It will answer just the question – Mayowa Ige Apr 04 '22 at 13:05
1 Answers
0
I have been working on this for like 5 days now but finally I got it.. So happy...
SELECT
result.StudentID, student.last_name, student.first_name, student.other_name, max(result.CSC331)
from result
INNER join student on result.StudentID=student.StudentID
and (student.Session = '2020/2021')
GROUP BY result.CSC331 desc
order by result.CSC331 desc
limit 1

Mayowa Ige
- 3
- 3