Using Enrollment.xml and Person.xml documents, I'm trying to list the names of students who have all A's. The ID field in Person refers to the StudentID field in Enrollment. There is an entry in enrollment for every class that a person is enrolled in (not one entry per student)
I can't seem to figure out how to write the query
Enrollment.xml form- >
<Document>
<Table>
<StudentID>170815037</StudentID>
<Grade>C</Grade>
</Table>
<Table>
<StudentID>193847547</StudentID>
<Grade>A</Grade>
</Table>
</Document>
Person.xml form - >
<Document>
<Table>
<Name>Wee Fletcher</Name>
<ID>115423723</ID>
</Table>
</Document>
Heres is what im trying working on, and i cant get it to work
for $a in doc("proj3/Person.xml")/Document/Table/ID
where every $s in doc("proj3/Enrollment.xml")//Table[StudentID = $a]
satisfies ($s/Grade = "A")
return $a/Name;