Reputation: 21
I have a student table with all details of student as below
Marks table as below
How can i get the students who have passed(35+ Marks) in atleast 1 or more subjects Which means Result shall not show Student NO 1 as he failed in all subjects. Group by dosent seems to work as it may pull Student No 2 also.
Upvotes: 0
Views: 766
Reputation: 73
I think something like this might work too ?
Select student.fname,student.lname from students inner join marks on marks.sid =
student.id where marks >= 35;
Upvotes: 0
Reputation: 23867
It would be like:
select *
from students
where exists (select * from
marks where marks.sid = students.id and marks.mark >= 35);
Note: Group By too would work. You could group by student id and get MAX(Mark) to compare if that is >= 35.
Upvotes: 3