I am trying to inner join two tables from access, but I am having trouble summarizing information from the second table. What is the proper syntax for averages within a query when using inner join?
Asked
Active
Viewed 1,160 times
-1
-
Please show us the query/code you currently have. – Tim Biegeleisen Nov 18 '15 at 04:30
-
Dim StudentDataAdapter As New OleDbDataAdapter("Select major, studstanding, from students inner join MIS on students.studentID = MIS.studentID ", StudentDataConnection) – dkjordan Nov 18 '15 at 04:31
-
Please post your table schema. – Tim Biegeleisen Nov 18 '15 at 04:32
-
I want an average from my MIS table of a particular column but I have no idea where the code for the average command should be placed. – dkjordan Nov 18 '15 at 04:33
-
What exactly should a table schema include? Column headings of the original table(s) or from the desired output? – dkjordan Nov 18 '15 at 04:36
-
more on inner joins : http://stackoverflow.com/questions/394853/sql-inner-join-syntax – Tharif Nov 18 '15 at 04:36
-
Show us the columns of the tables involved, along with ideally some sample input and output. If you do this, you will quickly get an answer. Please update soon before you are voted off. – Tim Biegeleisen Nov 18 '15 at 04:39
-
From Students: Major, StudentStanding; From MIS: quiz1, quiz2, quiz3 joined with studentID. I need averages for the different quizzes, but not sure where in the query to include the code. – dkjordan Nov 18 '15 at 04:40
-
Please do not add relevant information in comments. **Edit** your question and add it there. – Andre Nov 18 '15 at 09:53
1 Answers
0
This will return an average:
SELECT Students.StudentID,
AVG(quiz1) AS AverageOfQuiz1,
AVG(quiz2) AS AverageOfQuiz2,
AVG(quiz3) AS AverageOfQuiz3
FROM Students INNER JOIN MIS ON Students.StudentID = MIS.StudentID
GROUP BY Students.StudentID

Darren Bartrup-Cook
- 18,362
- 1
- 23
- 45