title: SQL Server - SELECT TOP 5 rows for each FK
body: <p>I've got the following query, that looks up the TOP 5 <em>Products</em> matching the search. Each <em>Product</em> is associated with a <em>Shop</em></p>
  
  <blockquote>
    <p>SELECT     TOP 5 * FROM     Products
    p, Shops s WHERE    p.ShopId =
    s.ShopId AND    p.ProductName LIKE
    '%christmas%'</p>
  </blockquote>
  
  <p>I need to extend this so that it returns me the TOP 5 <em>Products</em> in <strong>each</strong> <em>Shop</em>.</p>
  
  <p>Could anyone let me know how the query could be modified to achieve this? - i.e. choose the TOP 5 products matching "%christmas%" in <em>each</em> shop (rather than the current which shows the TOP 5 products matching "%chrismas%" across <em>all</em> shops).</p>