计算值出现多少次 [英] Counting how many times a value appeared

查看:71
本文介绍了计算值出现多少次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 SELECT FROM DISTINCT name FROM table 来获得一个表,该表具有出现在列中的不同名称。我如何获得一个额外的列,以返回该特定名称在该列上显示的次数?

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?

推荐答案

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

这篇关于计算值出现多少次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆