[英]How can I show the list of quizzes that the user did not participate in them?
I am developing a web-based training management system that provides the employees with weekly short quizzes. 我正在开发一个基于网络的培训管理系统,为员工提供每周简短的测验。 In profile section in the webiste, the employee should be able to see a list of the quizzes that he did not participate in them.
在网站的配置文件部分中,员工应该能够看到他没有参与的测验列表。 I could be able to let the system to show them but not after improving the system, it doesn't show.
我能够让系统显示它们但不是在改进系统之后,它没有显示。
First of all, I have the following database design: 首先,我有以下数据库设计:
Quiz Table: QuizID, Title, Description, IsSent
UserQuiz Table: ID, QuizID, Score, DateTimeComplete, Username
IsSent is a flag that refers to the quizzes that have been sent or not IsSent是一个标志,指的是已发送或未发送的测验
I put IsSent in the Quiz table because I want the Admin to be able to insert around 50 quizzes in a day. 我把IsSent放在测验表中,因为我希望管理员能够在一天内插入大约50个测验。 Then, the system will deal with sending them on a weekly basis.
然后,系统将处理每周发送它们的情况。 Now, when the user wants to see his profile and see the quizzes that he did not participate in them, he should see the the list of quizzes that have been sent and he did not participate in them.
现在,当用户想要查看他的个人资料并看到他没有参加的测验时,他应该看到已经发送的测验列表并且他没有参与。
The problem that I am facing it right now is that the system shows the quizzes that have not been sent as a list of quizzes that the employee did not participate in them and this is wrong. 我现在面临的问题是系统显示未作为员工没有参与的测验列表发送的测验,这是错误的。 So how I can fix this problem?
那我怎么解决这个问题呢?
My Query: 我的查询:
SELECT Title, Description
FROM dbo.Quiz
WHERE (NOT EXISTS
(SELECT QuizID
FROM dbo.UserQuiz
WHERE (dbo.Quiz.QuizID = QuizID) AND (Username = @Username)))
Add folllowing line in the end of the query 在查询结尾添加以下行
AND IsSent = 1
PS i'm assuming ur isSent
column is tinyint and 1 = true PS我假设你的
isSent
列是tinyint而1 = true
If I understand properly then you are looking for this query 如果我理解正确,那么您正在寻找此查询
select QuizID, Title, Description, from quiz
INNER JOIN userquiz ON quiz.QuizID= userquiz.QuizID
where quiz.issent = 1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.