Hi Experts,
It is late night (or morning!) here, I'm almost drowsy, and not getting this simple query behavior.
with t as (
select 1 val from dual union all
select 1 from dual union all
select 2 from dual union all
select null from dual union all
select null from dual union all
select null from dual
)
--------
select count(distinct val) from t; -->-- 2 records
But, why this query gives 3 records and includes the NULL value:
select count(*) from (select distinct val from t); -->-- 3 records
and
select count(val) from (select distinct val from t); -->-- 2 records
What am I missing. Any pointers?
Version: Oracle 11.2.0.4.0