on 2015 Mar 06 8:43 PM
Experts, I need your help. I have been tasked to come up with a query that would allow my end user to select a item code and a date range then return the AVG price for that date range. I see how I can get the AVG price from OITW for right now, but how is it calculated for a previous time period?
Thanks!
Hi,
Try this query:
SELECT T0.[ItemCode], T0.[Dscription], T0.[Warehouse], T0.[CalcPrice] FROM OINM T0 WHERE T0.[ItemCode] = [%0] and T0.[DocDate] between [%1] and [%2] and T0.[Warehouse] = [%3]
Thanks & Regards,
Nagarajan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi sir
The above query is perfect but our management asking with minimum price and maximum price within the warehouses with separate column Like shown below: is it possible
SELECT T0.[ItemCode], T0.[Dscription], T0.[Warehouse], MIN(T0.[CalcPrice]), MAX(T0.CalcPrice) FROM OINM T0 WHERE T0.[ItemCode] = [%0] and T0.[DocDate] between [%1] and [%2] and T0.[Warehouse] = [%3]
both answers are not correct
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
mmm.... nou... i see that Manish´s neither it is correct answer to Former member Question... it seems that is more complex that it looks like....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dears... you marked the Nagarajan Query like correct answer, but.... it is not the Manish's Query the correct !!??...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
Try this
SELECT T0.[ItemCode], T0.[Dscription], T0.[Warehouse], AVG(T0.[CalcPrice]) as [Avg Price] FROM OINM T0
WHERE T0.[ItemCode] = [%0] and T0.[DocDate] between [%1] and [%2] and T0.[Warehouse] = [%3]
GROUP BY t0.ItemCode,t0.Dscription,t0.Warehouse
ORDER BY t0.ItemCode
--Manish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
113 | |
8 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.