Skip to content

Instantly share code, notes, and snippets.

@enlacee
Created May 3, 2014 09:30
Show Gist options
  • Select an option

  • Save enlacee/ccbb7c02fe1a5db606cf to your computer and use it in GitHub Desktop.

Select an option

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

enlacee commented May 3, 2014

Copy link
Copy Markdown
Author

MYSQL REAL TIME

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