Hello List,
I submitted the code below:
select
(select count(*) from gemd.Respondents_tidy) - SUM (CASE WHEN gender in ('Male', '1', 'Female','2') THEN 1 ELSE 0 END) as N_missing,
SUM (CASE WHEN gender not in ('Male', '1', 'Female','2') THEN 1 ELSE 0 END) as m2
from gemd.Respondents_tidy
The code works without any error. I assume the columns of N_missing and m2 have same number. But they are not. N_missing return the correct number, but m2 give me 1 only. where is the problem of my coding? Does it means "not in" doesn't work?
I prefer the m2 way to calculate the result since it can reduce coding and easier to read.
Thanks,