[英]Total count in sql
I need to create a view that will display the total number of students who have declared two majors ( Major1
and Major2
are not null).我需要创建一个视图来显示已声明两个专业的学生总数( Major1
和Major2
不为空)。
What query should I use?我应该使用什么查询?
My goal is to get a single row of output so I know ORDER BY
clause is irrelevant in this case.我的目标是获得单行输出,所以我知道ORDER BY
子句在这种情况下无关紧要。
Something like this:像这样的东西:
CREATE VIEW GetNumberOfStudentswithMajor
AS
SELECT COUNT(*) FROM dbo.Students where Major1 is not null and Major2 is not null
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.