Foros del Web » Programación para mayores de 30 ;) » Bases de Datos General »

Problema Sql Rh Deduccion Por Renta

Estas en el tema de Problema Sql Rh Deduccion Por Renta en el foro de Bases de Datos General en Foros del Web. EL PROBLEMA QUE TENGO ES QUE TENGO QUE HACER UN SQL QUE ME CALCULE LA DEDUCCION POR RENTA DE LOS EMPLEADOS YA TENGO LISTO CASI ...
  #1 (permalink)  
Antiguo 25/09/2007, 22:37
 
Fecha de Ingreso: marzo-2007
Mensajes: 76
Antigüedad: 17 años, 1 mes
Puntos: 0
Problema Sql Rh Deduccion Por Renta

EL PROBLEMA QUE TENGO ES QUE TENGO QUE HACER UN SQL QUE ME CALCULE LA DEDUCCION POR RENTA DE LOS EMPLEADOS YA TENGO LISTO CASI TODO EL SQL PERO, NO SE COMO CONDICIONARLO PARA QUE ME HAGA EL CALCULO PARA TODOS LOS EMPLEADOS SI ALGUIEN ME PUEDE AYUDAR SE LO AGREDEZCO ESTE ES EL SQL:

SELECT top 1 IIF((SELECT Monto FROM RHEmpleados INNER JOIN RHPlanillasDetalle ON RHEmpleados.IdEmpleado = RHPlanillasDetalle.IdEmpleado WHERE TipoPlanilla=3 AND RHPlanillasDetalle.NumPlanilla =26 AND RHEmpleados.IdEmpleado=26 AND TipoMovimiento = "OS" AND CodMovimiento = "CV") IS NULL,0,(SELECT IIF(RHEmpleados.SueldoBase+Monto >468000, IIF( RHEmpleados.SueldoBase+Monto > 702000, (702000 /2 - 468000/2)*0.10, ((RHEmpleados.SueldoBase+Monto)/2 - 468000/2)*0.10) ,0) + IIF((RHEmpleados.SueldoBase+Monto)>=702000, ((RHEmpleados.SueldoBase+Monto)/2-702000/2)*0.15,0) FROM RHEmpleados INNER JOIN RHPlanillasDetalle ON RHEmpleados.IdEmpleado = RHPlanillasDetalle.IdEmpleado WHERE TipoPlanilla=3 AND RHPlanillasDetalle.NumPlanilla =26 AND RHEmpleados.IdEmpleado=26 AND TipoMovimiento = "OS" AND CodMovimiento = "CV")) AS Valor FROM RHPlanillasDetalle

LOS MOVIENTOS QUE TENGO QUE AGREGAR SON TipoMovimiento "CE" AND CodMovimiento"SB"
LES AGRADEZCO DE ANTEMANO.
  #2 (permalink)  
Antiguo 27/09/2007, 09:56
Avatar de Mithrandir
Colaborador
 
Fecha de Ingreso: abril-2003
Mensajes: 12.106
Antigüedad: 21 años
Puntos: 25
Re: Problema Sql Rh Deduccion Por Renta

IIF no existe en TSQL. Me atrevo a pensar que hablas de Access. Viene de SQL Server.
__________________
"El hombre, en su orgullo, creó a Dios a su imagen y semejanza."
Friedrich Nietzsche
  #3 (permalink)  
Antiguo 27/09/2007, 11:40
 
Fecha de Ingreso: marzo-2007
Mensajes: 76
Antigüedad: 17 años, 1 mes
Puntos: 0
Re: Problema Sql Rh Deduccion Por Renta

si la consulta es para access!!
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 05:48.