select COUNT(*) from Trajector_Tmpschedule tss, Trajector_Tmpschedule tse,aftn_tmpflightschedule
where
aftn_tmpflightschedule.id=tse.flight_schedule_id
and aftn_tmpflightschedule.id=tss.flight_schedule_id
and tss.routeseq<tse.routeseq
and tss.legseq=tse.legseq and tse.istoday='0'
and tss.pointid='2051' and tse.pointid='2100'
and aftn_tmpflightschedule.days like '%4%'
and (
(aftn_tmpflightschedule.validperiodbegin<'2008-11-27' and aftn_tmpflightschedule.validperiodend>='2008-11-27')
or(aftn_tmpflightschedule.validperiodbegin is null)
or( aftn_tmpflightschedule.validperiodbegin is null))
order by tss.pasttime asc
where
aftn_tmpflightschedule.id=tse.flight_schedule_id
and aftn_tmpflightschedule.id=tss.flight_schedule_id
and tss.routeseq<tse.routeseq
and tss.legseq=tse.legseq and tse.istoday='0'
and tss.pointid='2051' and tse.pointid='2100'
and aftn_tmpflightschedule.days like '%4%'
and (
(aftn_tmpflightschedule.validperiodbegin<'2008-11-27' and aftn_tmpflightschedule.validperiodend>='2008-11-27')
or(aftn_tmpflightschedule.validperiodbegin is null)
or( aftn_tmpflightschedule.validperiodbegin is null))
order by tss.pasttime asc
aftn_tmpflightschedule.id=tse.flight_schedule_id
and aftn_tmpflightschedule.id=tss.flight_schedule_id
select COUNT(*)
from Trajector_Tmpschedule a, aftn_tmpflightschedule b
where
b.id=a.flight_schedule_id and a.istoday='0'
and (a.pointid='2051' or a.pointid='2100' )
and b.days like '%4%'
and ((b.validperiodbegin <'2008-11-27' and b.validperiodend>='2008-11-27') or (b.validperiodbegin is null))
order by tss.pasttime asc