Ver Mensaje Individual
  #7 (permalink)  
Antiguo 23/09/2013, 14:49
Avatar de hmvr414
hmvr414
 
Fecha de Ingreso: marzo-2011
Ubicación: Santiago de Cali, Colombia
Mensajes: 74
Antigüedad: 13 años, 1 mes
Puntos: 16
Respuesta: suma entre rango de fechas mysql y php

resta las fechas

Código MySQL:
Ver original
  1. SELECT codigo,
  2.  
  3.   DATEDIFF((SELECT MAX(fecha) FROM tblFechas F WHERE F.codigo = tblFechas.codigo),
  4.           (SELECT MIN(fecha) FROM tblFechas F WHERE F.codigo = tblFechas.codigo))+1 AS dias
  5.  
  6. FROM tblFechas WHERE codigo =  '033p'
  7. GROUP BY codigo, dias;