Ver Mensaje Individual
  #3 (permalink)  
Antiguo 06/06/2013, 12:50
elasesino_broly
 
Fecha de Ingreso: abril-2013
Ubicación: venezuela
Mensajes: 92
Antigüedad: 11 años
Puntos: 1
Respuesta: function mysql

Gracias por tu respuesta me funciono asi:

Código MySQL:
Ver original
  1. DELIMITER $$
  2.  
  3. DROP FUNCTION IF EXISTS `ultimaFecha` $$
  4. CREATE DEFINER=`root`@`localhost` FUNCTION `ultimaFecha`(numeroOCL varchar(50),id_detalleL int) RETURNS date
  5. Declare fecha date;
  6.  
  7.    Set fecha =(   Select Max(Mov.fechaRecepcion)
  8.            From movimiento Mov
  9.             Inner Join detalle Det
  10.              On Det.id_detalle = Mov.id_detalle
  11.            Where Det.numeroOC=numeroOCL
  12.             And Det.id_detalle = id_detalleL
  13.             And Mov.tipoMovimiento = 1);
  14.  
  15.     RETURN fecha;
  16. End $$
  17.  
  18. DELIMITER ;
__________________
"Para el logro del triunfo es necesario pasar por las sendas de los sacrificios"