Obviously, I am missing something here. I am trying to get a count of each unique SSN in my table. The table may contain several records for the same SSN.
I am confused why these two queries give different counts:
Query A
select count(distinct mbr_ssn_nbr) from dsnp.pr01_t_mbr_hist
where empr_plan_cd in ('N', 'K')
and mbr_hist_svc_cr_dt = '2009-01-31'
Query B
select distinct count (mbr_ssn_nbr) from dsnp.pr01_t_mbr_hist
where empr_plan_cd in ('N', 'K')
and mbr_hist_svc_cr_dt = '2009-01-31'
What is the difference between the two uses of Distinct?
Thanks!
I am confused why these two queries give different counts:
Query A
select count(distinct mbr_ssn_nbr) from dsnp.pr01_t_mbr_hist
where empr_plan_cd in ('N', 'K')
and mbr_hist_svc_cr_dt = '2009-01-31'
Query B
select distinct count (mbr_ssn_nbr) from dsnp.pr01_t_mbr_hist
where empr_plan_cd in ('N', 'K')
and mbr_hist_svc_cr_dt = '2009-01-31'
What is the difference between the two uses of Distinct?
Thanks!