Ver Mensaje Individual
  #2 (permalink)  
Antiguo 11/12/2011, 20:00
Kid A
 
Fecha de Ingreso: junio-2007
Mensajes: 6
Antigüedad: 16 años, 11 meses
Puntos: 0
Respuesta: consulta a dos tablas y ordenar por fecha

Nadie me pudo ayudar pero se los comparto:

Código MySQL:
Ver original
  1. SELECT MAX( fech_mov ) , h. * , c. *
  2. FROM cliente c
  3. INNER JOIN historial h ON c.id_cliente = h.id_cliente
  4. WHERE h.ID_prece = (
  5. SELECT MAX( h2.ID_prece )
  6. FROM historial h2, cliente c2
  7. WHERE h2.ID_cliente = c.ID_cliente )
  8. GROUP BY c.ID_cliente