Are you using MySQL?yes of course :)
thanks, I didn't know it.OK, if you are then first simplify your query: group by 1
Then add the AVG column which will work ok with the "group by" :this doesn't work. this query extract the avarage of the import in the month, but I want the avarage importo for all the month. I could explain me not very well, my English isn't good. Let me try with an example: if I have the same data
select date_format(dt_imp,'%Y/%m') as date, SUM(imp), AVG(imp) from sp group by 1 order by 1
2002-12 10 2003-01 5 2003-02 11
the avarage I want is ((10 + 5 + 11) / 3) = 8.6.
with the example you gave me I got
+---------+----------------+----------------+ | month | SUM | avg | +---------+----------------+----------------+ | ... | | 2002/02 | 238.30 | 14.017647 | | 2002/03 | 1385.95 | 62.997727 | | 2002/04 | 475.30 | 20.665217 | | 2002/05 | 171.10 | 10.693750 | | ... | +---------+----------------+----------------+
thanks for your patience G.
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]