gpt4 book ai didi

mysql - 查询以获取 MySQL 中不同值的计数

转载 作者:行者123 更新时间:2023-11-29 04:09:04 25 4
gpt4 key购买 nike

我已经在 MySQL 中尝试了下面的查询,但没有成功。

select count(*)
from (
select count distinct(RADL_REQUEST_MSISDN)
from rbt_activation_details_log
where RADL_ACTIVE ='A'
group by RADL_REQUEST_MSISDN
);

最佳答案

select count(distinct column_whose_distinct_values_you_want_to_count) 
from rbt_activation_details_log
where RADL_ACTIVE ='A'
group by RADL_REQUEST_MSISDN

您在同一列上进行分组和计数,因此结果总是 1

编辑:

然后简单地省略group by子句

select count(distinct RADL_REQUEST_MSISDN) 
from rbt_activation_details_log
where RADL_ACTIVE ='A'

关于mysql - 查询以获取 MySQL 中不同值的计数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18405984/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com