Skip to content

Instantly share code, notes, and snippets.

@enlacee
Created May 3, 2014 09:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enlacee/ccbb7c02fe1a5db606cf to your computer and use it in GitHub Desktop.
Save enlacee/ccbb7c02fe1a5db606cf to your computer and use it in GitHub Desktop.
MYSQL DATE : filtro por intervalo desde ahora hasta hace 1 dia.
-- 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
@enlacee
Copy link
Author

enlacee commented May 3, 2014

MYSQL REAL TIME

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment