Skip to Content

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

SELECT 
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.[Quantity], 
T1.[U_DelDate] as 'Lead Time', 
T1.[ShipDate] as 'Actual Delivery Date' 

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

WHERE 
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

Rahul

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Dec 13, 2016 at 03:25 AM

    Hi Rahul,

    For a range of Cardcode, you need use >= for the first Cardcode parameter and <= for the second Cardcode parameter, like you did with date range.

    T0.[Cardcode] >= [%0] AND T0.[Cardcode] <= [%1]
    
    Kind Regards,
    Diego Lother
    Add comment
    10|10000 characters needed characters exceeded