Skip to content

Instantly share code, notes, and snippets.

@mttjohnson
Created April 22, 2021 22:17
Show Gist options
  • Save mttjohnson/6117759711e61540be577479269965db to your computer and use it in GitHub Desktop.
Save mttjohnson/6117759711e61540be577479269965db to your computer and use it in GitHub Desktop.
Magento 2 - Order Count by Date/Hour
-- Magento 2 Order Summary by date/hour
select date_format( created_at, '%Y-%m-%d %H:00' ) date_hour,
count(*) order_count
from sales_order o
where o.created_at > '2021-01-01' and o.created_at < '2021-04-10'
group by date_format( created_at, '%Y%m%d%H' )
having order_count > 100
order by order_count desc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment