Z
Zoran
Hi guys,
I have an assignment for which I use MS Access 2007. I have 2 tables
Student and Unit Enrolment.
The table Student holds info on students (StudentID, first name, last
name, phone etc)
The table UnitEnrol holds info on student enrolments in units
(StudentID, UnitCode, UnitGrade etc).
I am trying to get a report on a student who scored the highest grade
in a specific unit.
It works okay if I select just the score:
SELECT MAX (UnitGrade)
FROM UnitEnrol
WHERE UnitCode = "ICT100"
but when try to add several fields from another table, it returns
multiple records:
SELECT MAX (UnitGrade), SfName, SlName, PhoneNo
FROM Student, UnitEnrol
WHERE UnitCode = "ICT100" and Student.StudentID = UnitEnrol.StudentID;
GROUP BY SfName, SlName, PhoneNo;
it returns all records for the specified unit.
I also tried several combinations with HAVING and subqueries, but it
did not work.
Any advice would be highly appreciated.
Thanks
I have an assignment for which I use MS Access 2007. I have 2 tables
Student and Unit Enrolment.
The table Student holds info on students (StudentID, first name, last
name, phone etc)
The table UnitEnrol holds info on student enrolments in units
(StudentID, UnitCode, UnitGrade etc).
I am trying to get a report on a student who scored the highest grade
in a specific unit.
It works okay if I select just the score:
SELECT MAX (UnitGrade)
FROM UnitEnrol
WHERE UnitCode = "ICT100"
but when try to add several fields from another table, it returns
multiple records:
SELECT MAX (UnitGrade), SfName, SlName, PhoneNo
FROM Student, UnitEnrol
WHERE UnitCode = "ICT100" and Student.StudentID = UnitEnrol.StudentID;
GROUP BY SfName, SlName, PhoneNo;
it returns all records for the specified unit.
I also tried several combinations with HAVING and subqueries, but it
did not work.
Any advice would be highly appreciated.
Thanks