View Single Post
Old 09-19-2007, 04:20 AM   #5
mab9
Registered User
 
Join Date: Oct 2006
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
mab9 is on a distinguished road
From another board, someone linked to this code in an older post. After modifying & testing it, it looks like it works. Any issues with going this route rather than the MS route?

Code:
SELECT  
CategoryID 
, UnitsInStock 
FROM 
Products as x 
WHERE 
UnitsInStock in 
( SELECT  top 3 
  UnitsInStock 
  FROM Products 
  WHERE CategoryID = x.CategoryID 
  ORDER BY UnitsInStock desc 
);
mab9 is offline   Reply With Quote