All Cost type and Amount in Same Row F4105 table, We are not keeping price location wise
select a.colitm,a.comcu,a.coledg CostTy02,cast(a.councs/10000 as decimal (15,4)) Cost02,isnull(b.coledg,'') CostTy21,
isnull(cast(b.councs/10000 as decimal (15,4)),0) Cost21,isnull(c.coledg,'') CostTy25,isnull(cast(c.councs/10000 as decimal (15,4))/10000,0) Cost25
from proddta.f4105 a
left outer join proddta.f4105 b on a.colitm=b.colitm and a.comcu=b.comcu and b.coledg='21'
left outer join proddta.f4105 c on a.colitm=c.colitm and a.comcu=c.comcu and c.coledg='25'
where a.coledg='02' and a.coitm<>0 and a.colocn='' and a.councs<>0
select a.colitm,a.comcu,a.coledg CostTy02,cast(a.councs/10000 as decimal (15,4)) Cost02,isnull(b.coledg,'') CostTy21,
isnull(cast(b.councs/10000 as decimal (15,4)),0) Cost21,isnull(c.coledg,'') CostTy25,isnull(cast(c.councs/10000 as decimal (15,4))/10000,0) Cost25
from proddta.f4105 a
left outer join proddta.f4105 b on a.colitm=b.colitm and a.comcu=b.comcu and b.coledg='21'
left outer join proddta.f4105 c on a.colitm=c.colitm and a.comcu=c.comcu and c.coledg='25'
where a.coledg='02' and a.coitm<>0 and a.colocn='' and a.councs<>0
No comments:
Post a Comment