Forums Register Login

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

+Pie Number of slices to send: Send
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.


+Pie Number of slices to send: Send
There's a city wid manhunt for this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2125 times.
Similar Threads
Replacing resultset values
Wrongly Date is updated
Java Calendar Dates
Cobol to Java Record Format Conversion
how to display all months of a particular year according to the following rule
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 09:24:22.