M
mkbss
Unregistered / Unconfirmed
GUEST, unregistred user!
各位大哥大姐,请看以下的SQL语句:
select d.corppn"生产型号",d.Rev"版本",d.layer"层数",a.workno"工单号码",a.lotno"批卡号",a.outqty"出帐数量",a.inqty"入帐数量",
报废面积=a.inscrap*cast(g.paramvalue as float)*d.Layer,
a.passovertime"过数时间",a.passoverby"入帐人员",a.outscrap"废单元",a.inscrap"报废单元",
出帐单位=(select UnitName from Mkt_Unit where UnitNo=A.OutUnit),
入帐单位=(select UnitName from Mkt_Unit where UnitNo=A.InUnit),
毛面积=cast(cast(e.paramvalue as float)*cast(f.paramvalue as float)/10000 as float),
cast(g.paramvalue as float) as 单元面积,
b.techname"出帐工序",c.TechName"入帐工序",
OutAreaTotal=cast((CASE UPPER(a.OutUnit)
WHEN 'WP' THEN
CASE WHEN d.WplAry=0 THEN a.OutQty*d.AryPcs*d.QuotArea
ELSE a.OutQty*d.WplAry*d.AryPcs*d.QuotArea END
WHEN 'PNL' THEN a.OutQty*d.AryPcs*d.QuotArea
WHEN 'PCS' THEN a.OutQty*d.QuotArea END) as numeric(14,4)),
过数面积=cast((CASE UPPER(a.OutUnit)
WHEN 'WP' THEN
CASE WHEN d.WplAry=0 and d.layer<>0 THEN a.OutQty*cast(cast(e.paramvalue as float)*cast(f.paramvalue as float)/10000 as float)*d.Layer
ELSE a.OutQty*cast(cast(e.paramvalue as float)*cast(f.paramvalue as float)/10000 as float)*d.Layer END
WHEN 'PNL' THEN a.OutQty*cast(cast(e.paramvalue as float)*cast(f.paramvalue as float)/10000 as float)*d.Layer
WHEN 'PCS' THEN a.OutQty*cast(g.paramvalue as float)*d.Layer end) as numeric(14,4))
[red]when d.layer=0 then
毛面积=cast(cast(e.paramvalue as float)*cast(f.paramvalue as float)/10000 as float) end[/red]
from pro_passoverrec a left join
pub_TechInfo c on a.InTechNo=c.TechNo left join pub_techInfo b on a.OutTechNo=b.TechNo left join mkt_PnInfo d on a.ProdNo=d.ProdNo
left join ppe_miitem e on d.prodno=e.prodno left join ppe_miitem f on e.prodno=f.prodno left join ppe_miitem g on e.prodno=g.prodno
where 1=1 and e.itemno='0008' and f.itemno='0009' and g.itemno='0012'
and a.OutTechNo In (select techno from pub_TechInfo where passover =1) and a.InTechNo In( select techno from pub_TechInfo where passover =1)
Order By PassoverTime
一加上红色的语句就出错,小弟想不通有什么语法错误。
请高手不吝指点迷津。
谢谢
select d.corppn"生产型号",d.Rev"版本",d.layer"层数",a.workno"工单号码",a.lotno"批卡号",a.outqty"出帐数量",a.inqty"入帐数量",
报废面积=a.inscrap*cast(g.paramvalue as float)*d.Layer,
a.passovertime"过数时间",a.passoverby"入帐人员",a.outscrap"废单元",a.inscrap"报废单元",
出帐单位=(select UnitName from Mkt_Unit where UnitNo=A.OutUnit),
入帐单位=(select UnitName from Mkt_Unit where UnitNo=A.InUnit),
毛面积=cast(cast(e.paramvalue as float)*cast(f.paramvalue as float)/10000 as float),
cast(g.paramvalue as float) as 单元面积,
b.techname"出帐工序",c.TechName"入帐工序",
OutAreaTotal=cast((CASE UPPER(a.OutUnit)
WHEN 'WP' THEN
CASE WHEN d.WplAry=0 THEN a.OutQty*d.AryPcs*d.QuotArea
ELSE a.OutQty*d.WplAry*d.AryPcs*d.QuotArea END
WHEN 'PNL' THEN a.OutQty*d.AryPcs*d.QuotArea
WHEN 'PCS' THEN a.OutQty*d.QuotArea END) as numeric(14,4)),
过数面积=cast((CASE UPPER(a.OutUnit)
WHEN 'WP' THEN
CASE WHEN d.WplAry=0 and d.layer<>0 THEN a.OutQty*cast(cast(e.paramvalue as float)*cast(f.paramvalue as float)/10000 as float)*d.Layer
ELSE a.OutQty*cast(cast(e.paramvalue as float)*cast(f.paramvalue as float)/10000 as float)*d.Layer END
WHEN 'PNL' THEN a.OutQty*cast(cast(e.paramvalue as float)*cast(f.paramvalue as float)/10000 as float)*d.Layer
WHEN 'PCS' THEN a.OutQty*cast(g.paramvalue as float)*d.Layer end) as numeric(14,4))
[red]when d.layer=0 then
毛面积=cast(cast(e.paramvalue as float)*cast(f.paramvalue as float)/10000 as float) end[/red]
from pro_passoverrec a left join
pub_TechInfo c on a.InTechNo=c.TechNo left join pub_techInfo b on a.OutTechNo=b.TechNo left join mkt_PnInfo d on a.ProdNo=d.ProdNo
left join ppe_miitem e on d.prodno=e.prodno left join ppe_miitem f on e.prodno=f.prodno left join ppe_miitem g on e.prodno=g.prodno
where 1=1 and e.itemno='0008' and f.itemno='0009' and g.itemno='0012'
and a.OutTechNo In (select techno from pub_TechInfo where passover =1) and a.InTechNo In( select techno from pub_TechInfo where passover =1)
Order By PassoverTime
一加上红色的语句就出错,小弟想不通有什么语法错误。
请高手不吝指点迷津。
谢谢