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" <nor...@khine.net> > To: mysql@lists.mysql.com > 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 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=arch...@jab.org