Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 41 → Rev 42

/sun/TrafficCount/trunk/sql/report_per_day2.sql
35,41 → 35,41
union select 31 as day
) as d
left join tcount c2
on c2.source = 'fw_in'
on c2.source = 'tun0_in'
and c2.stamp = (
select max(stamp) as max_stamp
from tcount c1
where c1.source = 'fw_in'
where c1.source = 'tun0_in'
and c1.stamp >= date(d.day || ' Jan 2004')
and c1.stamp < date(d.day || ' Jan 2004') + interval '1 day'
group by date_trunc('day', c1.stamp)
)
left join tcount c3
on c3.source = 'fw_in'
on c3.source = 'tun0_in'
and c3.stamp = (
select max(stamp) as max_stamp
from tcount c4
where c4.source = 'fw_in'
where c4.source = 'tun0_in'
and c4.stamp >= date(d.day || ' Jan 2004') - interval '1 day'
and c4.stamp < date(d.day || ' Jan 2004')
group by date_trunc('day', c4.stamp)
)
left join tcount d2
on d2.source = 'fw_out'
on d2.source = 'tun0_out'
and d2.stamp = (
select max(stamp) as max_stamp
from tcount d1
where d1.source = 'fw_out'
where d1.source = 'tun0_out'
and d1.stamp >= date(d.day || ' Jan 2004')
and d1.stamp < date(d.day || ' Jan 2004') + interval '1 day'
group by date_trunc('day', d1.stamp)
)
left join tcount d3
on d3.source = 'fw_out'
on d3.source = 'tun0_out'
and d3.stamp = (
select max(stamp) as max_stamp
from tcount d4
where d4.source = 'fw_out'
where d4.source = 'tun0_out'
and d4.stamp >= date(d.day || ' Jan 2004') - interval '1 day'
and d4.stamp < date(d.day || ' Jan 2004')
group by date_trunc('day', d4.stamp)