How do i group by a case in oracle. ?
In sybase my statement looks like this.
select case when c.cust_unit_number is null then 'private' else 'business' end,count(distinct a.cust_id_resp)
from cm.account a, cm.customer c
where a.info_is_deleted = 'N'
and a.foreign_account is not null
and a.cust_id_resp = c.cust_id
and c.info_is_deleted = 'N'
group by case when c.cust_unit_number is null then 'privat' else 'bedrift' end
In sybase my statement looks like this.
select case when c.cust_unit_number is null then 'private' else 'business' end,count(distinct a.cust_id_resp)
from cm.account a, cm.customer c
where a.info_is_deleted = 'N'
and a.foreign_account is not null
and a.cust_id_resp = c.cust_id
and c.info_is_deleted = 'N'
group by case when c.cust_unit_number is null then 'privat' else 'bedrift' end