Reputation: 69
I'm trying to get the amount of jobbers (employees) per area (work) but i don't know how to do it. I tried doing this
select NOMBRE_ORDEN_TRABAJO,
id_usuario as Jobber_count
from tareas
group by NOMBRE_ORDEN_TRABAJO;
I get this
I think i should use the sentence COUNT.
This is my bd (in excel) where you can see i have an user id (ID USUARIO) and nombre orden trabajo (aerea/work name)... I'd like to count every jobber/employer per aera/work..
Upvotes: 0
Views: 24
Reputation: 156
You do need a COUNT
in there.
Try...
select NOMBRE_ORDEN_TRABAJO,
COUNT(id_usuario) as Jobber_count
from tareas
group by NOMBRE_ORDEN_TRABAJO;
This will give you the number of id_usuario
per NOMBRE_ORDEN_TRABAJO
If you are concerned there may be duplicates change to COUNT(DISTINCT id_usuario)
Upvotes: 1