else concat(format(ifnull(SJCL,0)/ifnull(YGL,0),2),'T') end as RJCL
from (select
(select count(*) FROM hpjx.T_HPPZ014
where COMPANY_CODE = #companyCode# and REG_DATE = #date# and FACTORY_CODE = #factorycode#
group by FACTORY_CODE) as YGL,
(select sum(USER_COUNT)
FROM hpjx.t_hpsc008
where COMPANY_CODE = #companyCode# and REGISTER_DATE = #date# and FACTORY_CODE = #factorycode# ) as YGL,
0 as JHCL,
(select sum(WEIGHT) FROM hpjx.T_HPXS001
where COMPANY_CODE = #companyCode# and REGISTER_DATE = #date# and FACTORY_CODE = #factorycode#
group by FACTORY_CODE) as SJCL
(select sum(WEIGHT)
FROM hpjx.t_hpsc008
where COMPANY_CODE = #companyCode# and REGISTER_DATE = #date# and FACTORY_CODE = #factorycode# ) as SJCL
from dual) a
</select>
...
...
@@ -28,13 +28,11 @@
case when ifnull(YGL,0) = 0 then '0.00T'
else concat(format(ifnull(SJCL,0)/ifnull(YGL,0),2),'T') end as LJRJCL
from (select
(select count(*) FROM hpjx.T_HPPZ014
where COMPANY_CODE = #companyCode# and left(REG_DATE,6) = left(#date#,6) and REG_DATE <![CDATA[<=]]> #date# and FACTORY_CODE = #factorycode#
group by FACTORY_CODE,left(REG_DATE,6)) as YGL,
(select sum(USER_COUNT) FROM hpjx.t_hpsc008
where COMPANY_CODE = #companyCode# and left(REGISTER_DATE,6) = left(#date#,6) and REGISTER_DATE <![CDATA[<=]]> #date# and FACTORY_CODE = #factorycode# ) as YGL,
0 as JHCL,
(select sum(WEIGHT) FROM hpjx.T_HPXS001
where COMPANY_CODE = #companyCode# and left(REGISTER_DATE,6) = left(#date#,6) and REGISTER_DATE <![CDATA[<=]]> #date# and FACTORY_CODE = #factorycode#
group by FACTORY_CODE,left(REGISTER_DATE,6)) as SJCL
(select sum(WEIGHT) FROM hpjx.t_hpsc008
where COMPANY_CODE = #companyCode# and left(REGISTER_DATE,6) = left(#date#,6) and REGISTER_DATE <![CDATA[<=]]> #date# and FACTORY_CODE = #factorycode# ) as SJCL
from dual) a
</select>
...
...
@@ -46,13 +44,15 @@
case when ifnull(YGL,0) = 0 then '0.00T'
else concat(format(ifnull(SJCL,0)/ifnull(YGL,0),2),'T') end as NLJRJCL
from (select
(select count(*) FROM hpjx.T_HPPZ014
where COMPANY_CODE = #companyCode# and left(REG_DATE,4) = left(#date#,4) and REG_DATE <![CDATA[<=]]> #date# and FACTORY_CODE = #factorycode#
group by FACTORY_CODE,left(REG_DATE,4)) as YGL,
(select
sum(USER_COUNT)
FROM hpjx.t_hpsc008
where COMPANY_CODE = #companyCode# and left(REGISTER_DATE,6) = left(#date#,4) and REGISTER_DATE <![CDATA[<=]]> #date# and FACTORY_CODE = #factorycode# ) as YGL,
0 as JHCL,
(select sum(WEIGHT) FROM hpjx.T_HPXS001
where COMPANY_CODE = #companyCode# and left(REGISTER_DATE,4) = left(#date#,4) and REGISTER_DATE <![CDATA[<=]]> #date# and FACTORY_CODE = #factorycode#
group by FACTORY_CODE,left(REGISTER_DATE,4)) as SJCL
(select
sum(WEIGHT)
FROM hpjx.t_hpsc008
where COMPANY_CODE = #companyCode# and left(REGISTER_DATE,6) = left(#date#,4) and REGISTER_DATE <![CDATA[<=]]> #date# and FACTORY_CODE = #factorycode# ) as SJCL