Ver Mensaje Individual
  #2 (permalink)  
Antiguo 29/01/2010, 16:08
Avatar de huesos52
huesos52
Colaborador
 
Fecha de Ingreso: febrero-2009
Ubicación: Manizales - Colombia
Mensajes: 5.980
Antigüedad: 15 años, 2 meses
Puntos: 360
Respuesta: calcular meses entre dos fechas con diferentes años

Con timestampdiff lo puedes conseguir.

Código MySQL:
Ver original
  1. mysql> select timestampdiff(month,'2009-12-01',curdate());
  2. +---------------------------------------------+
  3. | timestampdiff(month,'2009-12-01',curdate()) |
  4. +---------------------------------------------+
  5. |                                           1 |
  6. +---------------------------------------------+
  7. 1 row in set (0.00 sec)
  8.  
  9. mysql> select timestampdiff(month,'2009-08-04',curdate());
  10. +---------------------------------------------+
  11. | timestampdiff(month,'2009-08-04',curdate()) |
  12. +---------------------------------------------+
  13. |                                           5 |
  14. +---------------------------------------------+
  15. 1 row in set (0.00 sec)
  16.  
  17. mysql>

saludos
__________________
Without data, You are another person with an opinion.
W. Edwads Deming