I want to get order total of the month January 2019 for complete orders
I need to know tables related to this query, or if someone can share query that would be great.
-
order total, you mean the total number of orders for year 2019 or the total sum of amount of all the order for the specific month?fmsthird– fmsthird2019年03月26日 09:57:01 +00:00Commented Mar 26, 2019 at 9:57
-
I need sum amountMuhammad Anas– Muhammad Anas2019年03月26日 10:03:44 +00:00Commented Mar 26, 2019 at 10:03
2 Answers 2
Your questions seems double meaning for me, so here I'll post my answer assuming:
You want to get the Total Numbers of order for the specific month, below query should work
SELECT count(entity_id) FROM sales_order where state='complete' and status='complete' and month(created_at) = '01' and year(created_at) = '2019';
You want to get the total sum amount you can try this (This will filter only order that are completed):
SELECT sum(base_grand_total) FROM sales_order where state='complete' and status='complete' and month(created_at) = '01' and year(created_at) = '2019';
-
1It worked. ThanksMuhammad Anas– Muhammad Anas2019年03月26日 10:10:54 +00:00Commented Mar 26, 2019 at 10:10
Here is query which will give you order total of completed order's for month jan 2019:
SELECT sum(base_grand_total) FROM sales_order
WHERE created_at >='2018-12-31 23:59:59.000' AND created_at <= '2019-02-31
23:59:59.000' AND status='complete'
-
Thanks Mohit, but it is showing warning that incorrect datetime formatMuhammad Anas– Muhammad Anas2019年03月26日 10:03:08 +00:00Commented Mar 26, 2019 at 10:03
-
Thanks for answer. +1Muhammad Anas– Muhammad Anas2019年03月26日 10:48:48 +00:00Commented Mar 26, 2019 at 10:48