Created
April 22, 2014 14:55
-
-
Save kalenjordan/11182396 to your computer and use it in GitHub Desktop.
Average Sales Excluding Shipping, Tax, Discounts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
date_format(date_sub(created_at, INTERVAL 5 HOUR), "%Y-%m-%d") AS `Day` | |
, count(*) as `Count` | |
, AVG(grand_total - tax_amount - shipping_amount) AS `Avg Sales Excluding Tax/Shipping/Discounts` | |
, AVG(discount_amount) `Avg Discount` | |
, AVG(tax_amount) `Avg Tax` | |
, AVG(shipping_amount) `Avg Shipping` | |
FROM sales_flat_order | |
WHERE created_at BETWEEN '2014-04-01 05:00:00' AND '2014-04-30 05:00:00' | |
GROUP BY date_format(date_sub(created_at, INTERVAL 5 HOUR), "%Y-%m-%d") | |
ORDER BY date_format(date_sub(created_at, INTERVAL 5 HOUR), "%Y-%m-%d") DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment