Skip to Content

The below query will helpful to know future ordered quantities need to be manufactured for specific customer per month.Further the query result will be in tabular format.

Query:

Just paste the below query in query in query generator

SELECT [custcode]
as Custcode, [1] as Jan, [2] as Feb, [3] as Mar, [4] as Apr,  [5] as May, [6] as june, [7] as July, [8] as Aug, [9] as Sept, [10] as Oct, [11] as Nov, [12] as Dec

From

(select T0.[CardCode] as Custcode, sum(T0.[PlannedQty]) as PlanQty,month(T0.[DueDate]) as Month

from dbo.OWOR T0
where T0.[Status] NOT IN ( ‘C’ ) and (T0.[CardCode] between ‘XXX’ and ‘YYY’ or T0.[CardCode] between ‘SSS’ and ‘VVV’) and year(T0.[DueDate]) =2013 group by T0.[CardCode],T0.[DueDate] )s

Pivot

(sum(Planqty) for month IN ([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12])) P

order by [custcode]

Explanation:

The main two function of the query is Month and Year.

Month function will convert due date in to months like 1,2,3……12

Year function will convert due date to year like 2012, 2013

Input to query:

Add your customer code in the above query in  XXX, YYY, SSS and VVV

Same way you can report  for Released quantity, completed quantity for different customers.

Hope it will be helpful for producion department.

With Regards,

Nagarajan

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply