MYSQL sales report query

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
krishnan
Forum Newbie
Posts: 2
Joined: Thu Mar 11, 2010 7:42 am

MYSQL sales report query

Post by krishnan »

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
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: MYSQL sales report query

Post by AbraCadaver »

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.
mikosiko
Forum Regular
Posts: 757
Joined: Wed Jan 13, 2010 7:22 pm

Re: MYSQL sales report query

Post by mikosiko »

AbraCadaver wrote:That's very nice.
:) Nah... is a subliminal way to teach how to "not" write a select :wink: I'm feeling grateful now :mrgreen:
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: MYSQL sales report query

Post by John Cartwright »

Either start writting descriptive posts, or don't post at all. :banghead:
Post Reply