我有一个名为 test 的表,其中包含以下值。我想获取有多少用户正在使用开放 ID。
----+----------+-----------+
| NAME | PROVIDER | OPERATION |
+--------+----------+-----------+
| Samuel | Google | P |
| Samuel | Google | V |
| Kannan | Google | V |
| George | Google | V |
| Bush | Google | V |
| Bush | Yahoo | V |
+--------+----------+-----------+
询问:select distinct(Name) from test group by PROVIDER
结果:
+-----------------------+----------+
| count(distinct(NAME)) | PROVIDER |
+-----------------------+----------+
| 4 | Google |
| 1 | Yahoo |
+-----------------------+----------+
在此查询中,我想忽略PROVIDER的用户操作为P的计数。如何在单个查询中执行此操作?
输出应该是
+-----------------------+----------+
| count(distinct(NAME)) | PROVIDER |
+-----------------------+----------+
| 3 | Google |
| 1 | Yahoo |
+-----------------------+----------+