Counting how many times a value appeared

2019-08-02 01:17发布

问题:

I am using SELECT DISTINCT name FROM table to get a table with distinct names that appear in the column. How can i get an extra column returning the number of times that this specific name have appeared on the column?

回答1:

select name, count(1) from table
group by name;


标签: sql counting