View Full Version : Attemptin to show latest activity date in SKU database


J&JsTA
02-21-2007, 07:53 AM
Hey Guys & Gals, extreme newb here attempting to display the latest activity date in an SKU activity db in a query that spans 12 months with multiple activity dates on each of the 1,200 SKUS.

I have this so far and of course it only shows the last (DMAX) activity, not SKU related. How can I relate this result to each SKU to diplay the latest activity for each.

SELECT [Usage06-07].workorderDateClosed, [Usage06-07].qty, [Usage06-07].itemNo, [Usage06-07].Item
FROM [Usage06-07]
WHERE ((([Usage06-07].workorderDateClosed)=Dmax("workorderdateclosed","usage06-07","item")))
ORDER BY [Usage06-07].Item;



Thx in advance for your patience :)

Joe

FoFa
02-21-2007, 11:19 AM
Crate a primary query and call it Query1, as such:
SELECT [Usage06-07].itemNo, max([Usage06-07].workorderDateClosed) as mDateClosed
FROM [Usage06-07]
GROUP BY [Usage06-07].itemNo

SELECT [Usage06-07].workorderDateClosed, [Usage06-07].qty, [Usage06-07].itemNo, [Usage06-07].Item
FROM [Usage06-07]
INNER JOIN Query1 on [Usage06-07].itemNo = Query1.itemNo
AND Query1.mDateClosed = [Usage06-07].workorderDateClosed
WHERE 1=1
ORDER BY [Usage06-07].Item;

As one way.

J&JsTA
02-22-2007, 03:55 AM
Crate a primary query and call it Query1, as such:
SELECT [Usage06-07].itemNo, max([Usage06-07].workorderDateClosed) as mDateClosed
FROM [Usage06-07]
GROUP BY [Usage06-07].itemNo

SELECT [Usage06-07].workorderDateClosed, [Usage06-07].qty, [Usage06-07].itemNo, [Usage06-07].Item
FROM [Usage06-07]
INNER JOIN Query1 on [Usage06-07].itemNo = Query1.itemNo
AND Query1.mDateClosed = [Usage06-07].workorderDateClosed
WHERE 1=1
ORDER BY [Usage06-07].Item;

As one way.


Thank you, worked perfectly :)