Skip to Content
0
Jan 14, 2023 at 04:12 AM

Revise the query.

69 Views

Dear Experts,

Greetings of the day.

We have written a query for the analysis from Purchase Request to Purchase Order, with PR date as fetching to and from. But am unable to fetch the details of all the PR, whether open, close or cancelled.

Please can anyone guide?

SELECT distinct T1.[DocNum] 'PR No', T1.[DocDate] 'PR Date', T3.[LineNum], T3.[ItemCode], T3.[Dscription], T3.[Quantity], T2.[DocDate] 'PO Date', month(T2.[DocDate])'Month', DATEDIFF(DD,T3.[DocDate],T2.[DocDate])'Delay in Days' FROM POR1 T0 inner join OPRQ T1 on T0.BaseEntry= T1.DocEntry INNER JOIN OPOR T2 ON T0.[DocEntry] = T2.[DocEntry] INNER JOIN PRQ1 T3 ON T1.[DocEntry] = T3.[DocEntry] WHERE (T1.[DocDate] >=[%0] and T1.[DocDate] <=[%1])

Regards.