jquirossoto
jquirossoto

Reputation: 3

In getting the not a single-group group function error on this query, how can i solve this?

In getting the not a single-group group function error on this query, how can I solve this?

select to_char(fecha_ingreso,'DY') dia,
       count(num_dept) n
  from empleados
 group by dia

Upvotes: 0

Views: 177

Answers (1)

Florin Ghita
Florin Ghita

Reputation: 17643

The question is too simple, you should write:

select to_char(fecha_ingreso,'DY') dia,
       count(num_dept) n
from empleados
group by to_char(fecha_ingreso,'DY')

This is because select clause is evaluated after the group by clause.

Upvotes: 4

Related Questions