Hi everyone, I have a problem in writing a SELECT query for a stored procedure... I have two tables, Users and Orders which fileds are (simplifying): Users: UserID, UserName, etc... Orders: OrderID, UserID, OrderDate, etc... I should select the first N most recent orders for EACH User in Users Table. I've thought this method, using a temporary table which stores only the OrderID: - Loop through Users, and select the First N most recent Order for the user and insert the OrderIDs in a temp table - Return the Temp Table Joined with Orders Table. Is there a most efficient way to select with only one query? Thank you very much in advance!