Ver Mensaje Individual
  #12 (permalink)  
Antiguo 10/06/2013, 13:20
Avatar de Libras
Libras
Colaborador
 
Fecha de Ingreso: agosto-2006
Ubicación: En la hermosa perla de occidente
Mensajes: 7.412
Antigüedad: 18 años, 4 meses
Puntos: 774
Respuesta: me ayudan con la 2° parte de este query?

Código SQL:
Ver original
  1. WITH AllActivities AS ( SELECT ACTIVITY_NAME AS ACTIVIDAD, TO_CHAR(TRUNC(t.CREATION_TIME, 'HH'), 'DD-MON-YYYY HH24:MI:SS') AS HORA, COUNT (*) AS CANTIDAD FROM DB2USER.TASKS t
  2. WHERE t.CREATION_TIME> TO_DATE ('04-JUN-2013', 'dd - mon - yyyy')
  3. AND t.CREATION_TIME< TO_DATE ('05-JUN-2013', 'dd - mon - yyyy')
  4. AND t.BPD_NAME = 'CILI - Control Instrumental'
  5. AND t.ACTIVITY_NAME IS NOT NULL
  6. GROUP BY ACTIVITY_NAME, TO_CHAR (TRUNC (t.CREATION_TIME, 'HH'), 'DD-MON-YYYY HH24:MI:SS') ORDER BY ACTIVITY_NAME,
  7. TO_CHAR (TRUNC (t.CREATION_TIME, 'HH'), 'DD-MON-YYYY HH24:MI:SS') ASC )
  8.  
  9. SELECT AllActivities.actividad,total,g_total,
  10. CAST(total / CAST(g_total AS DECIMAL(10,4)) AS DECIMAL (10,4)) AS porce  
  11. FROM AllActivities
  12.  LEFT JOIN (SELECT SUM(total) g_total,hora FROM AllActivities GROUP BY hora) t1 ON (t1.hora=AllActivities.hora)

ahora prueba con esto :S
__________________
What does an execution plan say to t-sql query? Go f**k yourself, if you are not happy with me