This is my query:
SELECT product, loc, protype, ohvolumequantity, histseq
FROM dbo.pro_itm_hst
ORDER BY loc, protype, product, histseq
Every time the inventory is changed a history record is writting into this table to reflect the current on hand quantity. The first three fields are the same but the ohvolumequantity changes and the histseq is incremented.
I need to pull only one record for each unique Loc, Product, type, the one with the highest histseq #. I started to use MAX but that doesn't work.
Help! Thanks, Sarah
SELECT product, loc, protype, ohvolumequantity, histseq
FROM dbo.pro_itm_hst
ORDER BY loc, protype, product, histseq
Every time the inventory is changed a history record is writting into this table to reflect the current on hand quantity. The first three fields are the same but the ohvolumequantity changes and the histseq is incremented.
I need to pull only one record for each unique Loc, Product, type, the one with the highest histseq #. I started to use MAX but that doesn't work.
Help! Thanks, Sarah