PostgreSQL 9.4
.
I have the following table:
id player_id
serial PK integer
---------------------------
1
If all you need is a count of the number of rows where player_id
is 1, then you can do this:
SELECT count(*)
FROM your_table_name
WHERE player_id = 1;
If you want to count the number of rows for each player_id
, then you will need to use a GROUP BY
:
SELECT player_id, count(*)
FROM your_table_name
GROUP BY player_id;