query with sql pivot

0

I have this query but I like to add the number of calls and the sum TMO per hour example so I want to do it:

usuario       8           9           10
        cantidad|tmo    cantidad|tmo  cantidad|tmo
juan     20   | 45.20     20 |  10.3    52   |  15.3
....
...

I've only got here, I hope you give me a little hand

WITH Retenciones AS(
    SELECT 
        Retenciones.Llamadas_ACD, Retenciones.Usuario,Retenciones.Hora

    FROM [dbo].[Retenciones] 
    ) 


SELECT *
FROM Retenciones 
PIVOT( SUM(Llamadas_ACD) FOR Hora IN ([8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20])
 ) AS pt
    
asked by S.juarez 26.05.2018 в 01:34
source

0 answers