Ten most recent records by date

B

BenHuge

Hello All and thanks in advance for any help you can provide,

I am trying to create a query that grabs the ten most recent deliveries by
part number and then sum the number of items delivered in an inventory db
that I am creating. There are a few different tables linked by part number
and delivery with a date associated with each delivery. There are a few
hundred part numbers and I wanted to avoid creating a table for every part
number just to grab the ten most recent deliveries if that makes sense.

Here is the SQL for the table that sorts and counts the deliveries by part
number and it sums the number delivered by part number. It counts all of the
records and I need it to count just the ten most recent.

SELECT DISTINCTROW [Past Deliveries].[Part Number], Sum([Past
Deliveries].[Number Delivered]) AS [Sum Of Number Delivered], Count(*) AS
[Count Of Past Deliveries]
FROM [Past Deliveries]
GROUP BY [Past Deliveries].[Part Number];
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top