代码已经被我修改得乱七八糟了,大家将就看一下吧,谢谢啦
elseif request("stage1")="radio2" then
sql=""
sql=" select t2.calendar_year,t2.fiscal_week,t2.stngrp,t2.stn,t2.recipe,t2.maxbatch,round(avg(t1.pieces),2) pieces from (select t1.starttime,t1.stngrp,t1.stn,t1.pieces,recipe from (select trunc(starttime)starttime,count(pieces)pieces,maxbatch/25 maxbatch,stn,stngrp,recipe from csmc_short_view@dbre199 group by trunc(starttime),maxbatch,stn,stngrp,recipe )t1, (select trunc(calendar_date)repdate from day_master@dbre where calendar_year='"&request("t1_week_year")&"' and fiscal_week='"&request("t1_week")&"' and day_of_week='1' )t2, (select trunc(calendar_date)repdate from day_master@dbre where calendar_year='"&request("t2_week_year")&"' and fiscal_week='"&request("t2_week")&"' and day_of_week='1' )t3 where t1.starttime>=t2.repdate and t1.starttime<t3.repdate )t1, (select t2.repdate,t2.calendar_year,t2.fiscal_week,t1.recipe,t1.stngrp,t1.stn,t1.maxbatch from (select t1.starttime, t1.stngrp,t1.stn,t1.maxbatch,t1.recipe from (select trunc(starttime)starttime,count(pieces)pieces,maxbatch/25 maxbatch,stn,stngrp, recipe from csmc_short_view@dbre199 group by trunc(starttime),maxbatch,stn,stngrp,recipe )t1, (select trunc(calendar_date)repdate from day_master@dbre where calendar_year='"&request("t1_week_year")&"' and fiscal_week='"&request("t1_week")&"' and day_of_week='1' )t2, (select trunc(calendar_date)repdate from day_master@dbre where calendar_year='"&request("t2_week_year")&"' and fiscal_week='"&request("t2_week")&"' and day_of_week='1' )t3 where ( t1.starttime>=t2.repdate and t1.starttime<t3.repdate )t1, (select trunc(t1.calendar_date)repdate,t1.calendar_year,t1.fiscal_week "&_
" from day_master@dbre t1, (select trunc(calendar_date)repdate from day_master@dbre where calendar_year='"&request("t1_week_year")&"' and fiscal_week='"&request("t1_week")&"' and day_of_week='1' )t2, (select trunc(calendar_date)repdate from day_master@dbre where calendar_year='"&request("t2_week_year")&"' and fiscal_week='"&request("t2_week")&"' and day_of_week='1' )t3 where t1.calendar_date>=t2.repdate and t1.calendar_date<t3.repdate )t2 where t2.repdate=t1.starttime(+) )t2 where t2.repdate=t1.starttime and t2.stngrp=t1.stngrp(+) and t2.stn=t1.stn(+) and t2.recipe=t1.recipe(+) group by t2.calendar_year,t2.fiscal_week,t2.stngrp,t2.stn,t2.maxbatch,t2.recipe order by t2.recipe,t2.stn,t2.stngrp,t2.calendar_year,t2.fiscal_week "