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ChjKS04MyklMjYpIGZvciBjIGluICIs YWR5bSwqKSZ1enFe
enFmIiBdICkK

Re: sql query advise

am 24.06.2011 11:46:45 von Johan De Meersman

Have a look at GROUP BY and aggregate functions: http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.ht ml

----- Original Message -----
> From: "Norman Khine"
> 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=gcdmg-mysql-2@m.gmane.org