select i.interface, i.interface_oprstatus, gg.bytes_in / 1024 as bytes_in, i.utilization_out, gg.bytes_out / 1024 as bytes_out, i.errors_in, i.errors_out, j.discards_in, j.discards_out from
(select g.interface, g.interface_oprstatus, g.utilization_out, h.errors_in, h.errors_out from
(select a.interface, a.interface_oprstatus, b.utilization_out from
(select z.target as interface, y.samplevalue as interface_oprstatus,
(case when y.samplevalue = '1' then 'Up'
when y.samplevalue = '2' then 'Down'
end) as VALUE
from s_Qos_data z
join s_qos_snapshot y
on z.table_id = y.table_id
where z.qos = 'QOS_INTERFACE_OPERSTATUSPOLLABLE') a
INNER JOIN
(select x.target as interface, w.samplevalue as utilization_out from s_Qos_data x
join s_qos_snapshot w
on x.table_id = w.table_id
where x.source = 'ALL-3850.erieinsurance.com' and x.qos = 'qos_interface_utilizationout') b
on a.interface=b.interface ) g
INNER JOIN
(select c.interface, c.errors_in, d.errors_out from
(select v.target as interface, u.samplevalue as errors_in from s_Qos_data v
join s_qos_snapshot u
on v.table_id = u.table_id
where v.source = 'device.erieinsurance.com' and v.qos = 'qos_interface_pcterrorsin') c
INNER JOIN
(select t.target as interface, s.samplevalue as errors_out from s_Qos_data t
join s_qos_snapshot s
on t.table_id = s.table_id
where t.source = 'device.erieinsurance.com' and t.qos = 'qos_interface_pcterrorsout') d
on c.interface=d.interface) h
on g.interface=h.interface) i
INNER JOIN
(select e.interface, e.discards_in, f.discards_out from
(select p.target as interface, o.samplevalue as discards_in from s_Qos_data p
join s_qos_snapshot o
on o.table_id = p.table_id
where p.source = 'device.erieinsurance.com' and p.qos = 'qos_interface_pctdiscardsin') e
INNER JOIN
(select n.target as interface, m.samplevalue as discards_out from s_Qos_data n
join s_qos_snapshot m
on n.table_id = m.table_id
where n.source = 'device.erieinsurance.com' and n.qos = 'qos_interface_pctdiscardsout') f
on e.interface=f.interface) j
on i.interface=j.interface
INNER JOIN
(select cc.interface, cc.bytes_in, ff.bytes_out from
(select aa.target as interface, bb.samplevalue as bytes_in from s_Qos_data aa
join s_qos_snapshot bb
on bb.table_id = aa.table_id
where aa.source = 'device.erieinsurance.com' and aa.qos = 'qos_interface_bitsin') cc
INNER JOIN
(select dd.target as interface, ee.samplevalue as bytes_out from s_Qos_data dd
join s_qos_snapshot ee
on dd.table_id = ee.table_id
where dd.source = 'device.erieinsurance.com' and dd.qos = 'qos_interface_bitsout') ff
on ff.interface=cc.interface) gg
on j.interface=gg.interface