Ver Mensaje Individual
  #8 (permalink)  
Antiguo 02/09/2012, 08:16
jurena
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Cáceres
Mensajes: 3.735
Antigüedad: 16 años, 1 mes
Puntos: 300
Respuesta: Mostrar aquellos casos que no han dado seguimiento en las últimas 48 horas

Perdón, cometí un error. Editaré luego si armo la consulta.
Tal vez así, abimaelrc. Compruébalo.

SELECT t0.foo
FROM ((SELECT foo
FROM `test`
WHERE closed =0
AND created_datetime <= SUBDATE( NOW( ) , INTERVAL 3
DAY )
)t0 LEFT JOIN (SELECT foo FROM `test` WHERE closed = 1 and created_datetime <= SUBDATE(NOW(), INTERVAL 2 DAY))t1 ON t0.foo = t1.foo) WHERE t1.foo IS NULL

Un índice al campo foo ayudaría a hacerla más rápida.

Última edición por jurena; 02/09/2012 a las 08:38