I have tried this below query in MySQL but not working.
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
You're grouping and counting on the same column, so this will always give you 1 as result.
EDIT:
Then simply omit the group by clause
select count(distinct RADL_REQUEST_MSISDN)
from rbt_activation_details_log
where RADL_ACTIVE ='A'
By your query:
select count(*)
from
(select count distinct(RADL_REQUEST_MSISDN)
from rbt_activation_details_log
where RADL_ACTIVE ='A' group by RADL_REQUEST_MSISDN);
Appears as you want retrieve all distinct count not grouped by radl_request_msisdn. If so than you rewrite your query in this way:
select count distinct(RADL_REQUEST_MSISDN)
from rbt_activation_details_log
where RADL_ACTIVE ='A';
Instead if you want to grouped, the query will be:
select count distinct(RADL_REQUEST_MSISDN)
from rbt_activation_details_log
where RADL_ACTIVE ='A' group by RADL_REQUEST_MSISDN;
SELECT Count(UNIQUE(radl_request_msisdn))
FROM rbt_activation_details_log
WHERE radl_active = 'A'
GROUP BY radl_request_msisdn
select count distinct(RADL_REQUEST_MSISDN) from rbt_activation_details_log where RADL_ACTIVE ='A' group by RADL_REQUEST_MSISDN?