I have this:
SELECT AssignmentID
FROM ProblemView
GROUP BY AssignmentID
which returns 32 rows. But really what I want is the number 32. If I do this:
SELECT COUNT(*)
FROM lru.ProblemView
GROUP BY AssignmentID
I still get 32 rows, and the column is merely the count of the number of Assignments per problem.
I just need the number 32.
COUNT(*) returns the number of rows in a specified table, and it preserves duplicate rows. It counts each row separately. This includes rows that contain null values.
The COUNT(*) function returns the number of rows in a dataset using the SELECT statement. The function counts rows with NULL, duplicate, and non-NULL values. You can also use the WHERE clause to specify a condition.
The COUNT() function returns the number of rows that matches a specified criterion.
COUNT() With NULL ValuesSELECT COUNT(*) returns the count of all records in the result set regardless of NULL values. SELECT COUNT(attribute) returns the count of records containing non-NULL values of the specified column.
SELECT count(distinct AssignmentID)
FROM ProblemView
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With