Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3363

query to modify for the backdates

$
0
0

Dear All.

 

 

this query gives me the current date stock , but i need to check backdated stock .can some one modify this query please.

 

 

 

 

SELECT T5.FirmName as "Firm_Name", T4.[ItmsGrpNam] as "Group_Name",T0.ItemCode as [ItemCode] ,t0.indate,   T0.ItemName as "Item_Name", T0.[U_EA_Packgroup] as "Pack_Group", T3.[BLength1] as "Length", T3.[BWidth1] as "Width", T3.[BHeight1] as "Height", T6.[AvgPrice] as 'North item cost',0 as'south Item Cost',

Count(T0.DistNumber) as "Avl_In_Nh_Qty", SUM(T1.Quantity) as "Avl_In_Nh_Sqm",0 as "Avl_In_Sh_Qty", 0 as "Avl_In_Sh_Sqm" ,SUM(T1.Quantity) * T6.AvgPrice as 'North Total Cost' ,0 as 'South Total Cost'

       FROM OBTN AS T0   LEFT OUTER JOIN dbo.OBTQ AS T1 ON T0.ItemCode = T1.ItemCode AND T0.SysNumber = T1.SysNumber 

INNER JOIN dbo.OBTW AS T2 ON T0.ItemCode = T2.ItemCode AND T0.SysNumber = T2.SysNumber AND T1.WhsCode = T2.WhsCode

INNER JOIN OITM T3 ON T1.[ItemCode] = T3.[ItemCode] INNER JOIN OITB T4 ON T3.[ItmsGrpCod] = T4.[ItmsGrpCod]INNER JOIN OMRC T5 ON T3.[FirmCode] = T5.[FirmCode]

INNER JOIN OITW T6 ON T3.[ItemCode] = T6.[ItemCode] AND T0.ItemCode=T6.ItemCode AND T1.ItemCode=T6.ItemCode and T2.ItemCode=T6.ItemCode and T1.[WhsCode]=T6.[WhsCode]

where T3.[ManBtchNum] = 'Y' and T1.Quantity <>0 and T2.WhsCode <> 'Port' and T2.WhsCode <> 'HIGH SEA' and T2.WhsCode <> 'South'

group by T5.FirmName, T4.[ItmsGrpNam],T0.ItemCode , t0.indate,T0.ItemName,  T0.[U_EA_Packgroup], T3.[BLength1], T3.[BWidth1], T3.[BHeight1],T6.[AvgPrice] Having Count(T0.DistNumber) >=1 and  SUM(T1.Quantity) >1


Viewing all articles
Browse latest Browse all 3363

Trending Articles



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