如何在 ASP.NET 图表中显示测验标题以及每个测验中的用户数量?

发布于 2024-12-14 06:09:12 字数 281 浏览 0 评论 0原文

我正在我的网络应用程序中创建一个测验制作器。该数据库由以下表格组成:

  • QUIZ 表:QuizID、标题、描述
  • UserQuiz 表:UserQuizID、QuizID、DateTimeComplete、分数、用户名

现在,我想开发一个图表,显示测验的标题以及参加每个测验的用户数量其中一项测验,但我不知道如何进行。我正在尝试对此进行良好的查询,但我不知道如何进行。

我正在使用 SqlDataSource 来访问数据库中的数据。

请帮我。

I am creating a quiz maker in my web application. The database consists of the following tables:

  • QUIZ Table: QuizID, Title, Description
  • UserQuiz Table: UserQuizID, QuizID, DateTimeComplete, Score, Username

Now, I want to develop a chart the shows the title of quiz with the number of users who took each one of these quizzes, but I don't know how. I am trying to get a good query for this but I don't know how.

I am using SqlDataSource for accessing the data in the database.

Please help me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

命硬 2024-12-21 06:09:12

在 SQL 中,这可能类似于

SELECT  Q.QuizID, Q.Title, count(uq.*) as Users
  FROM  UserQuiz UQ
  JOIN  Quiz Q ON Q.QuizID = UQ.QuizID
GROUP BY Q.QuizID, Q.Title

或没有表别名 QUQ,这将

SELECT  Quiz.QuizID, Title, count(*) as Users
  FROM  UserQuiz
  JOIN  Quiz ON Quiz.QuizID = UserQuiz.QuizID
GROUP BY Quiz.QuizID, Title

使用完整的表名称来区分称为 QuizID 的两列。

In SQL this would be something like

SELECT  Q.QuizID, Q.Title, count(uq.*) as Users
  FROM  UserQuiz UQ
  JOIN  Quiz Q ON Q.QuizID = UQ.QuizID
GROUP BY Q.QuizID, Q.Title

or without the table aliases Q and UQ this would be

SELECT  Quiz.QuizID, Title, count(*) as Users
  FROM  UserQuiz
  JOIN  Quiz ON Quiz.QuizID = UserQuiz.QuizID
GROUP BY Quiz.QuizID, Title

using the full table names to distinguish between the two columns called QuizID.

万劫不复 2024-12-21 06:09:12

尝试像这样的标题如何?该

SELECT Title, count(UserQuizID) as usercount
FROM quiz a
JOIN userquiz b on a.quizid = b.quizid
GROUP BY Title

标题将是该系列的 XValueMember 和 usercount YValueMember

How about trying something like this

SELECT Title, count(UserQuizID) as usercount
FROM quiz a
JOIN userquiz b on a.quizid = b.quizid
GROUP BY Title

Title would be your XValueMember and usercount YValueMember for the series.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文