distinct()
命令: distinct
作用:去重
应用场景:需要统计类型,状态,计算区分度时。
例子:
mysql> select count(distinct(name))/count(*) from t_base_user; +--------------------------------+ | count(distinct(name))/count(*) | +--------------------------------+ | 0.6667 | +--------------------------------+ 1 row in set (0.00 sec)
登录后复制
以上就是MySQL如何使用distinct()命令的详细内容,更多请关注Work网其它相关文章!