不重复计数(*) [英] distinct count(*)

查看:81
本文介绍了不重复计数(*)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在MySQL中获得非重复计数(*).

How to do get distinct count(*) in MySQL.

例如,在表1中,我有1000万条记录,其中有重复的记录.

for example, in table1 i have 10 million record, there are duplicate records in it.

我想从表中找出不同的count(*).

I want to find out distinct count(*) from the table.

我知道,我可以做到

从表1中选择不同的* 但是,我不想获取1000万条记录,甚至不想在其他表中插入不同的记录,例如, 创建表table2从table1中选择不同的*

select distinct * from table1 but, i don't want to fetch 10 million records, not even want to insert distinct records in other table like, create table table2 select distinct * from table1

所以,请选择其他任何方法来帮助我.

So, please help me with any other option.

欢迎任何人的帮助

推荐答案

SELECT COUNT(DISTINCT field) FROM table

SELECT COUNT(*) FROM table GROUP BY field;

(顺便说一句-这个问题在本网站的其他地方已经被回答了很多次)

(btw - this has been answered quite a few times elsewhere on this site)

这篇关于不重复计数(*)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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