jsgar...@seguridad.unam.mx escribió:
> Buen día, alguno de ustedes podría ayudarme a hacer el promedio del  
> tiempo pero agrupado por mes para la siguiente tabla???:
>
>
>
>           tiempo       | date_part
> -----------------------+-----------
>  10 days 08:02:40      |        11
>  10 days 02:27:53      |        12
>  4 days 04:27:23       |        11
>  00:00:22              |        11
>  12 days 02:58:19      |        11
>  17 days 02:34:31      |         4
>  00:03:42              |        11
>  07:05:03              |        10
>  4 days 21:33:36       |         9
>
> He intentado con AVG(tiempo) y GROUP BY date_part pero no se resuelve.  
> Nos e si deba agregarle algo más.

Creo que necesitas un
group by date_trunc('month', fecha)

-- 
Alvaro Herrera                 http://www.amazon.com/gp/registry/CTMLCN8V17R4
"Executive Executive Summary: The [Windows] Vista Content Protection
 specification could very well constitute the longest suicide note in history."
      Peter Guttman, http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt
--
TIP 9: visita nuestro canal de IRC #postgresql-es en irc.freenode.net

Responder a