Ver Mensaje Individual
  #2 (permalink)  
Antiguo 19/05/2011, 18:40
scooby151
 
Fecha de Ingreso: enero-2007
Ubicación: Cali - Valle
Mensajes: 135
Antigüedad: 17 años, 4 meses
Puntos: 4
Respuesta: obtener la fecha mas reciente

Hola...

No estoy seguro pero creo que seria algo asi:
Código MySQL:
Ver original
  1.     inv.codigo,
  2.            nv.posicion,
  3.            ht.prof_ext,
  4.     ht.prof_med,
  5.     ht.prof_int,
  6.            max(ht.fecha) -- se adiciona el max
  7. FROM   neumaticos_vehiculos nv
  8.        LEFT JOIN neumaticos_inventario inv
  9.          ON inv.id_interno = nv.id_neumatico
  10.        LEFT JOIN neumaticos_historial ht
  11.          ON ht.id_neumatico = nv.id_neumatico AND ht.movimiento = 'cambio_entrante'
  12. WHERE nv.id_vehiculo = 95
  13. group by inv.codigo, -- de esta parte no estoy muy seguro
  14.            nv.posicion,
  15.            ht.prof_ext,
  16.     ht.prof_med,
  17.     ht.prof_in
  18. ORDER BY nv.posicion, ht.fecha DESC