This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Cloud Application Architecture Patterns: Designing, Building, and Modernizing for the Cloud and have Kyle Brown, Bobby Woolf and Joseph Yodor on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Get Sum of column and the retrive the data month wise.

 
Greenhorn
Posts: 19
Android PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a table which has product quantity column and the database has multiple entries in a single month.
For eg:
Date is in string format as i have used JXDatePicker so i was unable to store date in Date type in mySql .
Date format is (yyyy-MM-dd)
2013-03-01 > 1200 (This is product quantity)
2013-03-05 >200

2013-04-05 > 500
2013-04-10 > 1000

2013-05-05 > 850
2013-05-10 > 50

so i want data as

for March(2013-03-01 to 2013-03-31) > SUM OF product i.e : 1400.
April (2013-04-01 to 2013-04-30) > SUM OF product i.e : 1500.
May (2013-05-01 to 2013-05-31) > SUM OF product i.e : 900.

also i have different kind of propducts so i will be getting it according to product , For example purpose consider this records are ONLY FOR Product 'A' of Customer 'XYZ', So please consider this in where clause.

I have tried getting the data month wise using query as follows:



and i get the data as follows

the date format have changed because I have pasted it from Excel but please keep the date format as mentioned above.

SrNo delivery reciept no. delivery recipet date material received on customer name customer ID product name product ID quantity of product comments
1 bc-123 3/2/2013 3/5/2013 xyz 1 a 1 1500 1500 received
2 bc123123 1/3/2013 1/6/2013 xyz 1 a 1 123 asdfasf
3 bvc1234 2/7/2013 2/12/2013 xyz 1 a 1 1234 asdfasdf
6 bc123423 4/10/2013 4/19/2013 xyz 1 a 1 454 asdfasd
7 bc12343 5/1/2013 5/9/2013 xyz 1 a 1 456 asdfasdf
8 bc12345 6/18/2013 6/19/2013 xyz 1 a 1 1200 asdfasd
9 bc123-45 3/14/2013 3/26/2013 xyz 1 a 1 120 adsfasdf


This is the actual data from my database where i have 2 entries of March 3/2/2013 > 1500 & 3/14/2013 > 120 so i want the sum of it and not differently displaying both the records.


 
Ranch Hand
Posts: 108
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Duplicate post
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic