Bueno pues ya pude resolver lo del group by y el promedio
SELECT AVG(t.tiempo_resolver), date_part('month', c.dia_hora) FROM v_atendido a, v_concluido c, tiempo_resolver t WHERE a.caso_id=c.caso_id AND a.caso_id=t.caso_id GROUP BY date_part ORDER BY date_part ;
Gracias¡¡ ___________________________________________________________________________ Alvaro Herrera <alvhe...@alvh.no-ip.org> ha escrito:
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 Protectionspecification 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
---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.
binlZixn7AGqE.bin
Description: Clave PGP pública
-- TIP 1: para suscribirte y desuscribirte, visita http://archives.postgresql.org/pgsql-es-ayuda