1: 2: 3: 4: 5:
select distinct col1, col2, col3 , ( select count(distinct x.col3) from a x WHERE x.col1= a.col1 AND x.col2 = a.col2 ) cnt from a where col3 is not null