?
group by to_char(optdate, 'yyyymmdd')) t
--甲班
left join (select to_char(optdate, 'yyyymmdd') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '1'
and stationcode = '01'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymmdd')) t1
on t.o = t1.o
left join (select to_char(optdate, 'yyyymmdd') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '1'
and stationcode = '02'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymmdd')) t2
on t.o = t2.o
left join (select to_char(optdate, 'yyyymmdd') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '1'
and stationcode = '03'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymmdd')) t3
on t.o = t3.o
left join (select to_char(optdate, 'yyyymmdd') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '1'
and stationcode = '04'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymmdd')) t4
on t.o = t4.o
left join (select to_char(optdate, 'yyyymmdd') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '1'
and stationcode = '05'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymmdd')) t5
on t.o = t5.o
--乙班
left join (select to_char(optdate, 'yyyymmdd') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '2'
and stationcode = '01'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymmdd')) t6
on t.o = t6.o
left join (select to_char(optdate, 'yyyymmdd') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '2'
and stationcode = '02'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymmdd')) t7
on t.o = t7.o
left join (select to_char(optdate, 'yyyymmdd') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '2'
and stationcode = '03'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymmdd')) t8
on t.o = t8.o
left join (select to_char(optdate, 'yyyymmdd') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '2'
and stationcode = '04'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymmdd')) t9
on t.o = t9.o
left join (select to_char(optdate, 'yyyymmdd') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '2'
and stationcode = '05'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymmdd')) t10
on t.o = t10.o
--丙班
left join (select to_char(optdate, 'yyyymmdd') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '3'
and stationcode = '01'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymmdd')) t11
on t.o = t11.o
left join (select to_char(optdate, 'yyyymmdd') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '3'
and stationcode = '02'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymmdd')) t12
on t.o = t12.o
left join (select to_char(optdate, 'yyyymmdd') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '3'
and stationcode = '03'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymmdd')) t13
on t.o = t13.o
left join (select to_char(optdate, 'yyyymmdd') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '3'
and stationcode = '04'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymmdd')) t14
on t.o = t14.o
left join (select to_char(optdate, 'yyyymmdd') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '3'
and stationcode = '05'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymmdd')) t15
on t.o = t15.o
--丁班
left join (select to_char(optdate, 'yyyymmdd') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '4'
and stationcode = '01'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymmdd')) t16
on t.o = t16.o
left join (select to_char(optdate, 'yyyymmdd') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '4'
and stationcode = '02'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymmdd')) t17
on t.o = t17.o
left join (select to_char(optdate, 'yyyymmdd') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '4'
and stationcode = '03'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymmdd')) t18
on t.o = t18.o
left join (select to_char(optdate, 'yyyymmdd') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '4'
and stationcode = '04'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymmdd')) t19
on t.o = t19.o
left join (select to_char(optdate, 'yyyymmdd') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '4'
and stationcode = '05'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymmdd')) t20
on t.o = t20.o )
where substr(t.o,1,6)=?
order by t.o
]]>
?
group by to_char(optdate, 'yyyymm')) t
--甲班
left join (select to_char(optdate, 'yyyymm') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '1'
and stationcode = '01'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymm')) t1
on t.o = t1.o
left join (select to_char(optdate, 'yyyymm') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '1'
and stationcode = '02'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymm')) t2
on t.o = t2.o
left join (select to_char(optdate, 'yyyymm') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '1'
and stationcode = '03'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymm')) t3
on t.o = t3.o
left join (select to_char(optdate, 'yyyymm') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '1'
and stationcode = '04'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymm')) t4
on t.o = t4.o
left join (select to_char(optdate, 'yyyymm') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '1'
and stationcode = '05'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymm')) t5
on t.o = t5.o
--乙班
left join (select to_char(optdate, 'yyyymm') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '2'
and stationcode = '01'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymm')) t6
on t.o = t6.o
left join (select to_char(optdate, 'yyyymm') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '2'
and stationcode = '02'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymm')) t7
on t.o = t7.o
left join (select to_char(optdate, 'yyyymm') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '2'
and stationcode = '03'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymm')) t8
on t.o = t8.o
left join (select to_char(optdate, 'yyyymm') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '2'
and stationcode = '04'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymm')) t9
on t.o = t9.o
left join (select to_char(optdate, 'yyyymm') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '2'
and stationcode = '05'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymm')) t10
on t.o = t10.o
--丙班
left join (select to_char(optdate, 'yyyymm') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '3'
and stationcode = '01'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymm')) t11
on t.o = t11.o
left join (select to_char(optdate, 'yyyymm') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '3'
and stationcode = '02'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymm')) t12
on t.o = t12.o
left join (select to_char(optdate, 'yyyymm') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '3'
and stationcode = '03'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymm')) t13
on t.o = t13.o
left join (select to_char(optdate, 'yyyymm') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '3'
and stationcode = '04'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymm')) t14
on t.o = t14.o
left join (select to_char(optdate, 'yyyymm') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '3'
and stationcode = '05'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymm')) t15
on t.o = t15.o
--丁班
left join (select to_char(optdate, 'yyyymm') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '4'
and stationcode = '01'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymm')) t16
on t.o = t16.o
left join (select to_char(optdate, 'yyyymm') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '4'
and stationcode = '02'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymm')) t17
on t.o = t17.o
left join (select to_char(optdate, 'yyyymm') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '4'
and stationcode = '03'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymm')) t18
on t.o = t18.o
left join (select to_char(optdate, 'yyyymm') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '4'
and stationcode = '04'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymm')) t19
on t.o = t19.o
left join (select to_char(optdate, 'yyyymm') o, count(1) sumcount
from (select * from stl_bof_optinfo union select * from j#stl_bof_optinfo)
where substr(shiftcode, 2, 1) = '4'
and stationcode = '05'
and TERMINUSTEPT > ?
group by to_char(optdate, 'yyyymm')) t20
on t.o = t20.o )
where t.o between ? and ?
order by t.o
]]>