Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need Help with a query that gets the first and last date for each item 1

Status
Not open for further replies.

DougP

MIS
Joined
Dec 13, 1999
Messages
5,985
Location
US
I need a query that gets the first and last date for each item.
Items are brought into stock in an on going basis. Need to find the first day and last day an item was bought in.
What this does is show the same date for all three
[LastOfArrivalDelShip Date], [FirstOfArrivalDelShip Date], [ArrivalDelShip Date]
Here is what I have so far.
Code:
SELECT [Available to Promise].Item, Sum([Available to Promise].Quantity) AS SumOfQuantity, [Available to Promise].Warehouse, [Available to Promise].[ArrivalDelShip Date], Last([Available to Promise].[ArrivalDelShip Date]) AS [LastOfArrivalDelShip Date], First([Available to Promise].[ArrivalDelShip Date]) AS [FirstOfArrivalDelShip Date]
FROM [Available to Promise]
GROUP BY [Available to Promise].Item, [Available to Promise].Warehouse, [Available to Promise].[ArrivalDelShip Date];


DougP
[r2d2] < I Built one
 
Perhaps this ?
Code:
SELECT Item, Sum(Quantity) AS SumOfQuantity, Warehouse
, Max([ArrivalDelShip Date]) AS [LastOfArrivalDelShip Date]
, Min([ArrivalDelShip Date]) AS [FirstOfArrivalDelShip Date]
FROM [Available to Promise]
GROUP BY Item, Warehouse;

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top