From: Johan De Meersman Date: June 24 2011 9:46am Subject: Re: sql query advise List-Archive: http://lists.mysql.com/mysql/225326 Message-Id: <3f940878-927b-4472-8c17-e423939a593b@zimbra> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Have a look at GROUP BY and aggregate functions: http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html ----- Original Message ----- > From: "Norman Khine" > To: mysql@stripped > Sent: Thursday, 23 June, 2011 4:05:35 PM > Subject: sql query advise > > hello, > i have this SQL code in a python programme but i wanted to change the > SQL so that it returns totals for each date. or do i have to make a > loop for each date range so that i get the following results which > then i would like to plot on a graph. > > $ python daily_totals.py > (2L, Decimal('173.958344'), Decimal('159.966349')) 2011-06-23 > (6L, Decimal('623.858200'), Decimal('581.882214')) 2011-06-22 > ... > > here is the code: http://pastie.org/2111226 > > thanks > > norman > -- Bier met grenadyn Is als mosterd by den wyn Sy die't drinkt, is eene kwezel Hy die't drinkt, is ras een ezel