Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/05/2012, 21:15
izzmay
 
Fecha de Ingreso: mayo-2012
Mensajes: 1
Antigüedad: 12 años
Puntos: 0
Query calculo cesantias

Con este codigo intento calcular el valor por cesantias de un empleado


((select ct.sueldo
from contrato as ct
join datostrabajador as dt on ct.id=dt.contrato_id
join trabajador as t on dt.trabajador_id=t.id )
*
(SELECT DATEDIFF(CURDATE(),(
SELECT ct.fecha_ingreso
FROM contrato AS ct
JOIN datostrabajador AS dt ON ct.id = dt.contrato_id
JOIN trabajador AS t ON dt.trabajador_id = t.id
))))/36


Cuando lo ejecuto me sale el siguiente error, y no se porque

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* (SELECT DATEDIFF(CURDATE(),( SELECT ct.fecha_ingreso FROM contrato AS ct J' at line 5

Espero que alguien me pueda ayudar, gracias.