Hello friends, I'm trying to run the following query
select
x.[Nombre de empleado],x.[Sueldo diario],x.[Sueldo integrado],x.Total,x.conteo
from(
select
em.nombreLargo [Nombre de empleado],
em.sueldoDiario [Sueldo diario],
em.sueldoIntegrado [Sueldo integrado],
count(distinct convert(varchar,bi.FechaVerificacion,111)) conteo ,
CAST(em.sueldoDiario AS DECIMAL(18, 4)) +
CAST(em.sueldoIntegrado AS DECIMAL(18, 4)) [Total]
--COUNT(bi.FechaVerificacion) [días laborados]
from
sysCPEmpleados ce
inner join sysCPCentroCosto cc on
ce.idSysCPCentroCosto = cc.idSysCPCentroCosto
and
ce.idSysCPEmpresas = cc.idSysCPEmpresas
inner join sysCPEmpleados em on
em.idSysCPEmpresas = cc.idSysCPEmpresas
inner join sysCPEmpleadosBiometricoDetalle bi on
bi.idSysCPEmpleados = ce.idSysCPEmpleados
where cc.idSysCPCentroCosto ='SBIB15C'
--and em.idSysCPPuestos = @idPuestos
and em.idEstatus = 2
) as x
group by x.[Nombre de empleado],x.[Sueldo diario],x.[Sueldo integrado],x.conteo,x.Total
, but I do not know why he sent me this error:
Column 'sysCPEmployees.LargoName' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Could someone tell me what is failing me?