select datetime
     , n.site_id
     , avg(pd_packet_loss_rate)                      as pd_packet_loss_rate_percent
     , avg(mean_round_trip_delay_ms)                 as mean_round_trip_delay_ms
     , avg(mean_delay_jitter_ms)                     as mean_delay_jitter_ms
     , avg(rate_of_lost_detected_packet_1_div_10000) as rate_of_lost_detected_packet_1_div_10000
from r11.pl_2g_hourly p
         join network_site n on p.network_site_id = n.id
where date between date_int(7) and date_int(1)
group by datetime
       , n.site_id
order by n.site_id
       , datetime;


