All pastes #436043 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-04-12 09:49 UTC
rendered paste body
churn=# select reg,count(distinct case when no_of_mon=1 then cust_cod else null
end) as base,count(distinct case when no_of_mon=2 and status='churn' then cust_c
od else null end) as current FROM churn WHERE arpu_id IN('1000-2000')  AND c_typ
e='P' GROUP BY reg;
 reg | base | current
-----+------+---------
 1   |  595 |      19
 2   |    0 |       0
 5   | 3453 |     177
 6   |   48 |       4
 7   |    4 |       0
 8   | 1756 |      34
 9   |    1 |       0
 G   |    3 |       0

(8 rows)

actually it shd not show the reg "2" but its showing, why it is?