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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrive Last 3 Actions by Project 1

Status
Not open for further replies.

johnve

Technical User
Dec 6, 2006
10
AU
Hi , I have a database where in one table I have a list of my projects and in the second table I a list of actions which are linked to the project. I want to run a query then report on the last 3 actions for each project. I have tried SELECT TOP 3 but it only gives my top 3 in that table not by each project.

Can anyone help me.. Thanks
 
You can use a query with a subquery. Since you didn't provide and table or field information maybe you can modify this example of the most recent three Orders for each CustomerID in the Northwind Orders table:
Code:
SELECT Orders.OrderID, Orders.CustomerID, Orders.OrderDate, Orders.RequiredDate, Orders.ShippedDate, Orders.Freight
FROM Orders
WHERE (((Orders.OrderID) In (SELECT TOP 3 OrderID from Orders O where O.CustomerID = Orders.CustomerID ORDER BY OrderDate Desc)))
ORDER BY Orders.CustomerID, Orders.OrderDate DESC;

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
dhookom, Thank you very much for your assistance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top