mysql - SQL query to retrieve SUM in various DATE ranges -


i have table information sold products, customer, date of purchase , summary of sold units.

the result trying should 4 rows 1st 3 january, february , march. last row products weren't sold in these 3 months.

here table. http://imageshack.us/a/img823/8731/fmlxv.jpg

the table columns are:

id sale_id product_id quantity customer_id payment_method_id total_price date time 

so in result 1st 3 row just:

  • january, sum january
  • february, sum february
  • march, sum march , next row should april, there no items in april yet, don't know how go this.

editor's note: based on linked image, columns above year 2013.

i go following

select sum(totalprice), year(date), month(date)  sales group year(date), month(date) 

Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -