select sales_reg,no_of_mon, count(distinct(case when c_type='P' then cust_cod end)) as "pre_paid", count(distinct(case when c_type='N' then cust_cod end)) as "post_paid", count(distinct(case when c_type='P'and status='active' then cust_cod end)) as "pre_ret", count(distinct(case when c_type='N'and status='active' then cust_cod end)) as "post_ret", count(distinct(case when c_type='P'and status='churn' then cust_cod end)) as "pre_churn", count(distinct(case when c_type='N'and status='churn' then cust_cod end)) as "post_churn", count(distinct(cust_cod)) as total_customer from churn group by no_of_mon,sales_reg having total_customer>500; ERROR: column "total_customer" does not exist i cant find there is a wrong in the query. pls tell me why?