I need to calculate the number of victims, processed and crimes, once I have counted these data I need to associate them so that they all appear in a single query, I have the table of victmas
, procesados
and delitos
and all they have in common a variable called id_expedientes
, I made this code, but at the time of making the query it marks me as id_expedientes
is ambiguous
select Id_expediente,
count(id_victima) as no_victima,
count(id_procesado) as no_procesado,
count(id_delito) as no_delito
from expedientes
left join procesados on procesados.id_expediente=expedientes.Id_expediente
left join victimas on victimas.id_expediente=expedientes.Id_expediente
left join delitos on delitos.Id_expediete=expedientes.Id_expediente
group by 1 ;