Skip to Content

sales order frequency

Hi experts

I need a query with sales order frequency with amount(withou VAT) additionally country field from OCRD table

In my query shows only sales order frequency how to achive that

SELECT p.cardcode,p.CardName, [4] as [Apr], [5] as [May], [6] as [Jun], [7] as [Jul], [8] as [Aug], [9] as [Sep], [10] as [Oct], [11] as [Nov], [12] as [Dec], [1] as [Jan], [2] as [Feb], [3] as [Mar] FROM (SELECT t0.cardcode,t0.CardName ,(T0.docentry) as Docentry,MONTH(T0.Docdate)as month FROM dbo.ORDR T0 WHERE T0.DocDate between '04-22-16' and '04-22-17' and t0.CANCELED='N' ) S PIVOT (count(Docentry) FOR [month] IN ([4],[5],[6],[7],[8],[9],[10],[11],[12],[1],[2],[3])) P ORDER BY p.cardcode,p.CardName



Add comment
10|10000 characters needed characters exceeded

0 Answers