mysql计数唯一行值 [英] mysql count unique row values

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

问题描述

TABLE quotations

id  clientid
1   25
2   25
3   25
4   25
5   26

如何查询 TABLE quotation 中有多少个不同的用户端?

How can I query how many different clients exist in TABLE quotation? I don't want duplicate entries to be counted more than once.

我需要的答案是 2 因为只有非重复的条目是( 25 26 )。

I need the answer to be 2, in 1 row, because the only non-duplicated entries are (25, 26).

推荐答案

select count(distinct clientid) from quotation

阅读更多

这篇关于mysql计数唯一行值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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