assuming I have the following table:

```
NUM  TYPE  STAT   ERR
123   10      6    62
123   10      6    62
123   10      6    62
123   17      4     0
321   10      6    62
321   10      6    62

```

I'm currently using the following query:

```
select MIN(NUM) as NUMBER
     , MIN(STAT) as STATUS
     , MIN(ERR) as ERROR
     , MIN(retry) as RETRY 
 from TABLE_TB 
where ERR=62 
group by NUM 
having count(ERR) > 1;

```

The output will be:

```
NUM  TYPE  STAT   ERR  RETRY
123   10      6    62      3
321   10      6    62      2

```

That's ok, but what I need is that the query will output only `NUM` WITH ERR=62 but also with ERR = 0 excluding those who have ERR=62 but without ERR=0. Taking the first table as example, the query should output

```
NUM  TYPE  STAT   ERR  RETRY
123   10      6    62      3

```

This because NUM 123 has ERR=62 (3 occurrency) but also ERR=0. So, NUM 321 will be excluded because even if has ERR=62, it doesn't have ERR=0.

Hope is cliear :)

Thank you very much.
Lucas