Count how many rows have the same value [duplicate]
Solution 1:
Try
SELECT NAME, count(*) as NUM FROM tbl GROUP BY NAME
SQL FIDDLE
Solution 2:
If you want to have the result for all values of NUM
:
SELECT `NUM`, COUNT(*) AS `count`
FROM yourTable
GROUP BY `NUM`
Or just for one specific:
SELECT `NUM`, COUNT(*) AS `count`
FROM yourTable
WHERE `NUM`=1