select cod_n,cod_grupo,cod_tipo,cod_sec,count(*) from iptb00004 where ventas = 1 and ano = 1999 group by 1,2,3,4