Created
May 3, 2014 09:30
-
-
Save enlacee/ccbb7c02fe1a5db606cf to your computer and use it in GitHub Desktop.
MYSQL DATE : filtro por intervalo desde ahora hasta hace 1 dia.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Filtro por intervalo desde ahora hasta hace 1 dia | |
SELECT | |
slots.slot, | |
slots.name, | |
slots.min, | |
slots.max, | |
AVG(datos.valor) valor | |
FROM slots | |
LEFT JOIN datos ON slots.slot = datos.slot | |
WHERE DATE(datos.fecha) < NOW() | |
AND DATE(datos.fecha) > DATE_SUB(NOW(), INTERVAL 1 DAY) -- TIEMPO FILTRO 1 MIN (PROMEDIO DE 1 MIN O 1 HORA) | |
GROUP BY slots.slot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
MYSQL REAL TIME