简体   繁体   English

如何显示用户未参与的测验列表?

[英]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.

相关问题 如何使用 EF Core 6.0“拆分”表以参与两种不同的关系? - How can I "split" a table using EF Core 6.0 to participate in two different relationships? 即使我没有存储密码,程序也可以存储密码吗? - Can the program store the password even if I did not store them? 如何独立重设测验分数? - How to reset score for quizzes independently? 如何将通用Funcs添加到列表并执行它们? - How can I add generic Funcs to a list and execute them? 如何列出具有目录级别的文件和目录 - How can I list files and directories with them directory levels 如何显示此测验引擎每个月和每年的参与者总数和已测验? - How to show the total number of participants and taken quizzes in each month and year for this quiz engine? 如何显示激活和停用规则的列表? - How to show the list of rules to activate and inactivate them? 如何在报告的列表中显示列表? - How can I show a list within a list in a report? 如何存储对象列表的初始状态,以便可以将它们与更新的列表进行比较? - How do I store the initial state of a list of objects so that I can compare them to an updated list? 如何在 C# 的 LIST&lt;&gt; 中动态获取用户输入的多个字段,而不像我在下面的代码中那样进行硬编码? - How to take user input of multiples fields in LIST<> in C# dynamically not hard coded like i did the code below?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM