MySQL Forums
Forum List  »  Spanish

Media de tiempos
Posted by: Berta Nasarre
Date: January 31, 2014 04:12AM

Hola,

Estoy utilizando un sistema de tickets llamado bugzilla, y me gustaría saber la media que pasan los tickets en cada estado. Hace mucho que no hago querys.... así que me esta resultando un poco costoso.

Un ejemplo de la tabla (bugs_activity) que tengo es este:

bug_id / bug_when / fieldid / added / removed
3894 / 12/26/2013 10:28 / 9 / CONFIRMED / NEW
3894 / 12/30/2013 12:20 / 9 / DEVELOPMENT / CONFIRMED
3894 / 12/30/2013 12:22 / 9 / SUPPORT / DEVELOPMENT
3806 / 12/30/2013 16:10 / 9 / DEVELOPMENT /SUPPORT
3894 / 12/30/2013 17:36 / 9 / DEVELOPMENT / SUPPORT
3894 / 12/30/2013 17:40 / 9 / SUPPORT / DEVELOPMENT
3894 / 12/31/2013 10:07 / 9 / DEVELOPMENT / SUPPORT
3894 / 12/31/2013 12:56 / 9 / P DEVELOPMENT / DEVELOPMENT
3914 / 1/2/2014 10:09 / 14 / Critical / Medium
3914 / 1/2/2014 10:09 / 9 / CONFIRMED / NEW
3914 / 1/2/2014 10:09 / 13 / critical /normal
3914 / 1/2/2014 10:58 / 9 / DEVELOPMENT / CONFIRMED
3914 / 1/2/2014 10:58 / 9 / P DEVELOPMENT / DEVELOPMENT
3914 / 1/2/2014 16:23 / 9 / SUPPORT / P DEVELOPMENT


Luego en otra tabla me relaciona el bug_id con el Product_id que necesito.


Pues bueno, tal y como explicaba, lo que quiero saber es la media en que los tickets estan en estado DEVELOPMENT, SUPPORT, CONFIRMED....


Incialmente la query que tenia es asi:

SELECT AVG(DATEDIFF(T1.bug_when, T2.bug_when)) AS AVG_TIME FROM bugs_activity T1, bugs_activity T2, bugs T3
WHERE T1.fieldid=9 AND T2.fieldid=9 AND T1.bug_id = T2.bug_id AND T3.bug_id = T2.bug_id AND T3.product_id=6
AND (T1.removed = "CONFIRMED")AND (T2.added = "CONFIRMED") and YEAR(T3.creation_ts)=2013;


pero veo que no esta bien, ya que de alguna manera tambien he de relacionar con que otro registro quiero que me haga el cambio, no?

Si yo tengo:

3894 11/26/2013 10:28 9 CONFIRMED NEW
3894 11/30/2013 12:20 9 DEVELOPMENT CONFIRMED
3894 11/30/2013 12:22 9 SUPPORT DEVELOPMENT
3894 12/30/2013 17:36 9 DEVELOPMENT SUPPORT
3894 12/31/2013 17:40 9 SUPPORT DEVELOPMENT
3894 10/30/2014 17:40 9 DEVELOPMENT SUPPORT
3894 10/30/2014 17:40 9 SUPPORT DEVELOPMENT

Como puedo asociar el que los registros que quiero es que sean consecutivos para que no me compare el primer cambio de Suport a development con el ultimo cambio de estado de development a support, por ejemplo?

Tendría que ordenar primero la tabla en orden cronológico y entonces seria consecutivo?

Por otro lado he visto que el DATEDIFF excluye los cambios hechos en el mismo dia, y no se si seria mas real utilizar alguna funcion que diferenciara a partir de horas como el TIMESTAMPDIFF.

Bueno,

A ver si sacamos algo :)

Gracias!

Options: ReplyQuote


Subject
Views
Written By
Posted
Media de tiempos
1296
January 31, 2014 04:12AM
689
February 05, 2014 02:42AM
721
February 05, 2014 01:29PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.