Count Favorite ms-access

113 Views Asked by At

I have 3 existing tables: Instructor, Feedback, Class

In Feedback table, 2 columns

Class_ID
Likes

(Class_ID link with the attendance, as each member attend 1 class eg. class 1,2,3,etc. and Likes is for the number of people like the class).

In Instructor table, column relevant:

Instructor_ID

In Class table, column relevant:

Class_ID
Instructor_ID

I need a query to report a favorite instructor i.e instructor_ID with max(likes).

Select
Class_ID.Class,
Instructor_ID.Instructor,
Likes.Feedback
WHERE Max(Likes.Feedback)

Suggestions/Corrections are welcomed.Thank you

EDIT

Select
Exercise_class_attendance.Class_ID,
Exercise_Instructor.Instructor_ID,
Feedback_FaceBook.Likes,
Max(Likes) FROM Feedback_Facebook AS Highest_Number_Like
GROUP BY Instructor_ID

This is the query I am working on and it asked me to enter parameter value of every element in the code. Spelling checked.

1

There are 1 best solutions below

4
On

If you use the query design window, it will show you where the problem(s) are. You cannot have a field (column) that is not part of GROUP BY or summed/counted etc:

Select
Exercise_class_attendance.Class_ID,
Exercise_Instructor.Instructor_ID,
Feedback_FaceBook.Likes,
Max(Likes) AS Highest_Number_Like
FROM Feedback_Facebook, Exercise_class_attendance, Exercise_Instructor
GROUP BY Exercise_Instructor.Instructor_ID, Exercise_class_attendance.Class_ID,
   Feedback_FaceBook.Likes

This is not a good query, it is only some notes.

You will make like a lot easier for yourself if you read up on aliases.