Skip to content

Instantly share code, notes, and snippets.

@willboudle
Created January 7, 2018 12:49
Show Gist options
  • Select an option

  • Save willboudle/80d8f8a7e45abb97e1b9d5624940610b to your computer and use it in GitHub Desktop.

Select an option

Save willboudle/80d8f8a7e45abb97e1b9d5624940610b to your computer and use it in GitHub Desktop.
Average Orders Per Day sql magento
SELECT AVG( orders_num )
FROM (
SELECT created_at, COUNT( DISTINCT order_id ) orders_num
FROM `sales_flat_order_item`
WHERE created_at > "2016-07-01 00:00:00"
AND created_at < "2017-01-01 00:00:00"
GROUP BY CAST( created_at AS DATE )
)orders_per_day
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment