简体   繁体   中英

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).

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.

Something like this:

    CREATE VIEW GetNumberOfStudentswithMajor

    AS

    SELECT COUNT(*) FROM dbo.Students where Major1 is not null and Major2 is not null

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM