Answer the question
In order to leave comments, you need to log in
SQL how to implement counting the number of identical values in a column?
Knowledgeable people tell me.
There is a column of the form:
1
1
1
2
2
2
3
3
3
3
How to get the output: number of units: 110 number of twos: 120 number of triples: 120
Answer the question
In order to leave comments, you need to log in
If we have such a table:
Then, by executing such a query:
SELECT
MAX(num) AS Name,
COUNT(num) AS Count
FROM
dbo.TestTable
GROUP BY (num)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question