'SQL Multiple return values

I have a table, Test with one column, ItemNo as an integer. I want to count the number of equal ItemNo's. Getting the count one at a time is easy:

SELECT COUNT(ItemNo) FROM Test WHERE ItemNo=1;

which returns 3. How can I have all results (in an array or similar) in one go?

The table Test with the ItemNo column:

1
1
1
2
2
3
3
3
3
4
4


Solution 1:[1]

SELECT ItemNo,Count(*)as cntt
FROM your_table
GROUP BY ItemNo

Solution 2:[2]

select ItemNo, count(1) from Test group by ItemNo;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sergey
Solution 2 user3327034