Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8491

Re: Need Pivottable in SAP

$
0
0

Hi Peter,

 

Try this pivot query:

 

SELECT [CustName] as CustName,[PartName] as ItemNo, [Produkt] as ProductDesc, [KW] as Week,  isnull([1],0) as Jan, isnull([2],0) as Feb, [3] as Mar, isnull([4],0) as Apr,  isnull([5],0) as May, isnull([6],0) as june, isnull([7],0) as July, isnull([8],0) as Aug, isnull([9],0) as Sept, isnull([10],0) as Oct, isnull([11],0) as Nov, isnull([12],0) as Dec

from
( SELECT T0.[CardName] as CustName, T1.[ItemCode] as PartName, T1.[Dscription] as Produkt, CONVERT(nvarchar(2), DATEPART(ISOWK, T1.ShipDate)) AS KW, CONVERT(decimal(19,2), sum(T1.Quantity * T1.NumPerMsr)) AS Tonnen, month(T1.ShipDate) as month

FROM ORDR T0  INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry

WHERE  year(T1.ShipDate) = 2010

GROUP BY T0.CardName, T1.ShipDate, T1.Quantity, T1.ItemCode, T1.Dscription ) S


Pivot
(Sum(Tonnen) FOR Month IN ([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12])) P

 

Hope helpful.

 

Thanks & Regards,

Nagarajan


Viewing all articles
Browse latest Browse all 8491

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>