Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

In one query statement 1

Status
Not open for further replies.

aauxta

Programmer
Feb 9, 2001
7
US
This really got me and it seems really simple though:

StudentID CourseID Grade
--------- -------- -----
123 111 A
123 222 B
456 111 A
456 222 A
456 333 A

I just couldn't figure out how to use just one query to find out the studentID who has straight A only... thanks in advance guys!
 

Try this...


SELECT DISTINCT StudentID
FROM student_grade sg1
WHERE Grade = 'A'
AND NOT EXISTS (SELECT *
FROM student_grade sg2
WHERE sg2.StudentId = sg11.StudentId
AND Grade <> 'A'
)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top