SELECT SUM(ORDER_PRODUCTS_TABLE.price) AS TOTAL_SALE,
DATE_FORMAT(ORDER_DETAILS.created_datetime, '%b') AS month,
DATE_FORMAT(ORDER_DETAILS.created_datetime, '%c') AS month_no
FROM ORDER_PRODUCTS AS ORDER_PRODUCTS_TABLE
LEFT OUTER JOIN ORDER_DETAILS AS ORDER_DETAILS ON(ORDER_PRODUCTS_TABLE.order_id = ORDER_DETAILS.order_id)
WHERE
YEAR(ORDER_DETAILS.created_datetime) = (GIVE CURRENT YEAR)
GROUP BY month ORDER BY ORDER_DETAILS.created_datetime
MYSQL sales report query
Moderator: General Moderators
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: MYSQL sales report query
That's very nice.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: MYSQL sales report query
AbraCadaver wrote:That's very nice.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: MYSQL sales report query
Either start writting descriptive posts, or don't post at all. 