usman400,
This may not be the most elegant way to do this but it will get you what you need.
You will need to create 3 queries with the following SQL in each of them.
1. QryNotPassed:
Code:
SELECT Table1.StudentID, Table1.StudentName, Table1.Result
FROM Table1
WHERE (((Table1.Result)<>"Passed"));
2. QryPassed:
Code:
SELECT Table1.StudentID, Table1.StudentName, Table1.Result
FROM Table1
WHERE (((Table1.Result)="Passed"));
3. QryFinal
[You have to name the first two queries with the names that I gave them in order for this one below to work. You can have different names for the above two queries - but you'll have to change the names accordingly in the SQL below]:
Code:
SELECT QryNotPassed.StudentID, QryNotPassed.StudentName, QryNotPassed.Result
FROM QryNotPassed
WHERE NOT EXISTS
(Select QryPassed.StudentID
From QryPassed
Where QryNotPassed.StudentID = QryPassed.StudentID);
I have a feeling that this can all be done in one query - but I do not know how. I'll try & find out.
Let me know if you have any questions.