Skip to Content
Dec 13, 2016 at 02:03 AM

Shipped vs Lead Time Query


Hello Experts

I have written a query to check for order that have been shipped against lead time

When I use only one card code to check with a date range, it works

but as soon as I added it to check a range of card code with a date range, it didn't work and I don't get any results

Where am I going wrong?

Please help

T0.[DocNum] as 'Sales Order No', 
T0.[CardName] as 'Sales Partner', 
T0.[NumAtCard] as 'Cust Ord No', 
T1.[U_Prod_Order_No] as 'Prodn Ord No', 
T1.[ItemCode] as 'Stock Code', 
T1.[Dscription] as 'Stock Description', 
T1.[U_DelDate] as 'Lead Time', 
T1.[ShipDate] as 'Actual Delivery Date' 

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

T0.[CardCode] =[%0] AND 
T0.[CardCode] =[%1] AND 
T0.[DocStatus] = 'c' AND  
T0.[DocStatus]  !=  'L' AND   
T1.[ShipDate]  >=[%2] AND   
T1.[ShipDate]  <=[%3] 

ORDER BY T1.[ShipDate]

Thanks and Regards