SQL Server Update: "Using CASE Expressions": "Using CASE Expressions"
select mcco sdkcoo,imlitm sdlitm ,imdsc1 sddsc1,limcu sdmcu,rtrim(wwgnnm)+' '+ltrim(wwsrnm) OwnerName, rtrim(wpar1)+' '+ltrim(wpph1) phoneNo,sum(lipqoh)lipqoh,sum(sdsoqs)sdsoqs,wk1 = CASE WHEN sdtrdj=108110 then sum(sdsoqs) end, wk2 = CASE WHEN sdtrdj=108117 then sum(sdsoqs) end, wk3 = CASE WHEN sdtrdj=108121 then sum(sdsoqs) end, sdsrp1,sdsrp2,sdsrp3,sdsrp4,sdsrp5,sdprp1,sdprp2--into #temp_sales1from vItemdetail nolockleft outer join jde_cccccc.ccccc.f4211 on sditm=liitm and sdmcu=limcu and sddcto in ('SF','SI','SO')where mcco=870 and lipqoh<>0-- and ((@mcu is null) or (ltrim(limcu)=ltrim(@mcu))) group by mcco,imlitm,imdsc1,limcu,sdsrp1,sdsrp2,sdsrp3,sdsrp4,sdsrp5,sdprp1,sdprp2,wwsrnm,wwgnnm,wpar1,wpph1,sdtrdj
http://www.svdeals.com/
No comments:
Post a Comment