本文介绍了创建具有COUNT ms访问权限的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据库,我想创建一个带有COUNT函数的表。是否有可能?

I have a database and I want to create a table with COUNT function in it. Is it possible ?

我有3个现有的表:

Member
Feedback
Attendance

在反馈表中,2列

Class_ID,
Likes

(Class_ID与考勤链接,每个成员参加1班,例如班1,2,3等,Likes是班上的人数)。

(Class_ID link with the attendance, as each member attend 1 class eg. class 1,2,3,etc. and Likes is for the number of people like the class).

在考勤表中,3列:

Class_ID
Member_ID
Non_member_name

现在我想更改反馈表以添加2个新列。一个计数参加类的人数,例如,如果有4个人参加类1,将有4行Class_ID = 1。两个计数喜欢的百分比,即喜欢/数量_attending * 100%

Now I want to alter Feedback table to add 2 new columns. One to count the number of people attend the class, e.g if there is 4 people attend class 1,there would be 4 rows of Class_ID=1. Two to count the percentage of likes i.e Likes/Number_attending*100%

ALTER TABLE Feedback
ADD COUNT(*) AS Number_Attending
WHERE Class_ID.Feedback=Class_ID.Attendance

我试图运行,但有

推荐答案

例如:

 SELECT Class_ID, Count(Member_ID) As MemCount, Count(Non_Member_Name) As NonMemCount
 FROM Attendances
 GROUP BY Class_ID

请参阅

这篇关于创建具有COUNT ms访问权限的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 23:13