Dear liscete,

Here is something you might want to look - you need Northwind database and SQL Server 2005.

I would suggest you run the innermost select first, then both the inner and outer select, and you might want to experiment with the 'between 1 and 3' (try between 1 and 10)

Thanks,
Dominique

select * from
(
select orderid, CustomerID, orderdate, row_number() over (partition...