Hey
in the query you r using
"where marks is less than max(sum(marks))"
This will be true for all the records as individual marks will be less than sum of them
SELECT
Student.stud_id,
Student.stud_name,
Max(subject.marks)
FROM Student, subject, stud_sub
WHERE sum(marks)<
( SELECT Max(sum(marks)) FROM student, subject, stud_sub
WHERE student.stud_id = stud_sub.stud_id
AND stud_sub.sub_id = Subject.sub_id GROUP BY stud_id)
GROUP BY stud_id
ORDER BY sum(marks) desc
LIMIT 1;
Reputation Points: 22
Solved Threads: 9
Junior Poster in Training
Offline 83 posts
since Jun 2008