Tuesday, March 15, 2011

Join and update F41021 PQOH field

select ilmcu,ilitm,illocn,sum(iltrqt) TRQT  into QOH_USA
from proddta.f4111
where ilmcu like '% USA'
group by ilmcu,ilitm,illocn
order by ilmcu,ilitm,illocn
 
select * from proddta.f4111 where ilmcu ='         tor'
--UPDATE proddta.f41021 SET lipqoh =trqt
select lipqoh,TRQT,*
from proddta.f41021
INNER JOIN QOH_USA on ilITM=liitm and rtrim(ltrim(limcu))=rtrim(ltrim(ilmcu)) and illocn=lilocn
where rtrim(ltrim(limcu))=rtrim(ltrim(ilmcu)) and ilITM=liitm  and illocn=lilocn and
limcu   = '         USA'  and lipqoh<>trqt
select lipqoh,TRQT,*
--UPDATE proddta.f41021 SET lipqoh =trqt
from proddta.f41021
INNER JOIN QOH_SHYE on ilITM=liitm and rtrim(ltrim(limcu))=rtrim(ltrim(ilmcu))
where rtrim(ltrim(limcu))=rtrim(ltrim(ilmcu)) and ilITM=liitm  and illocn=lilocn and
limcu   = '        SHYE' and lipqoh<>trqt
 

--UPDATE jde_production.proddta.f4102 SET ibprp1 =imprp1
--select imlitm,imprp1,ibprp1,iblitm,ibmcu
from jde_production.proddta.f4102
left outer JOIN jde_production.proddta.f4101 on imitm=ibitm
where iblitm is not null and imprp1='ETC'

 

No comments: