Skills on Display Orders of Zen-Cart.

Especially at the end of every month, we need to know how many orders we have. Here are 2 method you may like when you use Zen-Cart.

First, if you need to know certain latest new orders, say 2000, how to do then, you can use the following mysql command:
SELECT * FROM `orders` order by orders_id desc limit 0,2000;  //show latest orders;

Second is we can use the following mysql code to show all the products with a month, say display all products within March, 2012:

SELECT date_purchased, SUM(order_total) FROM `orders` where date_purchased between “2012-03-01” and “2012-03-30”;

For some phpmyadmin or mysql version, we need to use the followng code:

SELECT date_purchased, SUM(order_total) FROM orders where date_purchased between “2012-03-01” and “2012-03-31”;
If we need to know all orders in a year, say 2011, how to then? Simple:

SELECT date_purchased, SUM(order_total) FROM `orders` where date_purchased between “2011-01-01” and “2011-12-31”;

Here we can use SUM(order_total) to caculate total value within a period.

Show orders, not include unpaid and canceled orders within a month:

SELECT date_purchased, SUM(order_total) FROM orders where date_purchased between “2012-08-01” and “2012-08-31” and  order_status <> “1”  and order_status <> “9”