on 10-22-2020 10:13 AM
Hi Experts,
I have a requirement to get all the Goods Reciept POs that have the TaxDate that falls within the current week.
I have a UDT with all the From Dates and To dates that select the Week No. E.G.
Code | From Date | To Date
202031 | 27/07/20 | 02/08/20
So the dates between To and From give me the Week Code.
I need to get all the Goods Reciept POs that the TaxDate falls between the to and from dates of the current week only.
This is what I have so far, but I can't see past how to get the current week code and only get the records that the week code is the same as...
SELECT
T2.[Code],
T1.[ItemCode],
sum(T1.[Quantity]) as 'Quantity'
FROM
OPDN T0
INNER JOIN PDN1 T1 ON T0.[DocEntry] = T1.[DocEntry]
INNER JOIN [dbo].[@DATE] T2 ON T0.[U_Wk] = T2.[Code]
WHERE getdate() BETWEEN T2.U_From and T2.U_to
GROUP BY T1.[ItemCode], T2.[Code]
ORDER BY T1.[ItemCode] ASC
I think the getdate () clause should not be here, instead it uses parameters to enter the date values from - to. Example:
Where T1. [ItemCode]> = [% 0] and T2. [Code] <= [% 1]
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.