问题描述
我如何从多个表?我正在尝试打印用户的答案表以在datagridview中显示。但是,我需要
来从三个不同的表中提取所需的数据:tblQuestions,tblQuizAnswers和tblQuizResults。
以下是每张表所需的列:
tblQuizAnswers:
- StudentID
- FirstName
- LastName
- pCourse
- CourseSubject
- QuizID1
- QuizTitle
- QuizNumber
- 答案
- DateTaken
tblQuizResults:
- QuizScore
- QPercentage
tblQuestions:
- ActualQuestion
- CorrectAnswer
- AnswerExplanation
这是表之间的共同点:
tblQuestions& tblQuizAnswers:
- QuizID / QuizID1
- QuizTitle / QuizTitle
- QuestionNumber / QuizNumber
- CourseSubject / CourseSubject
- CorrectAnswer / CorrectAnswer
tblQuestions& tblQuizResults:
- QuizID / QuizID1
- QuizTitle / QuizTitle
- CourseSubject / CourseSubject
tblQuizAnswers& tblQuizResults:
- StudentID / StudentID
- FirstName / FirstName
- LastName / LastName
- pCourse / pCourse
- CourseSubject / CourseSubject
= QuizID1 / QuizID
- QuizTitle / QuizTitle
所有三个表:
- QuizID
- QuizTitle
- CourseSubject
我还需要显示用户答案的相应数据。例如,用户对
特定测验的第一个问题的答案是字母A(这是唯一的数据)保存在数据库中),我需要在gridview中显示什么是选项A.
How do I query from multiple tables? I am trying to print a user's answer sheet to show in a datagridview. However, I need to pull the needed data from three different tables: tblQuestions, tblQuizAnswers, and tblQuizResults.
Here are the columns I need from each table:
tblQuizAnswers:
-StudentID
-FirstName
-LastName
-pCourse
-CourseSubject
-QuizID1
-QuizTitle
-QuizNumber
-Answer
-DateTaken
tblQuizResults:
-QuizScore
-QPercentage
tblQuestions:
-ActualQuestion
-CorrectAnswer
-AnswerExplanation
Here's what's common between the tables:
tblQuestions & tblQuizAnswers:
-QuizID/QuizID1
-QuizTitle/QuizTitle
-QuestionNumber/QuizNumber
-CourseSubject/CourseSubject
-CorrectAnswer/CorrectAnswer
tblQuestions & tblQuizResults:
-QuizID/QuizID1
-QuizTitle/QuizTitle
-CourseSubject/CourseSubject
tblQuizAnswers & tblQuizResults:
-StudentID/StudentID
-FirstName/FirstName
-LastName/LastName
-pCourse/pCourse
-CourseSubject/CourseSubject
=QuizID1/QuizID
-QuizTitle/QuizTitle
all three tables:
-QuizID
-QuizTitle
-CourseSubject
I also need to show the corresponding data for the user's answer. For example, the user's answer for question number one for a particular quiz is letter A (and that's the only data that's being saved in the db), I need to show in my gridview what was option A.
这篇关于查询多个表 - VB.Net/MS Access 2013的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!