Skip to content

Instantly share code, notes, and snippets.

@ziadoz
Last active May 22, 2023 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ziadoz/353db40a814af5f2e7e2cd271ad17aa7 to your computer and use it in GitHub Desktop.
Save ziadoz/353db40a814af5f2e7e2cd271ad17aa7 to your computer and use it in GitHub Desktop.
MySQL Select 15 Minute Time Series
with recursive 15min_windows as (
select
curdate() + interval 8 hour as start,
curdate() + interval 8 hour + interval 15 minute as end
union
select
end,
end + interval 15 minute
from 15min_windows
where end < curdate() + interval 16 hour
)
select * from 15min_windows;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment