Filtering Database Results to Top n Records for Each Value in a Lookup Column
问题 Let's say I have two tables in my database. TABLE:Categories ID|CategoryName 01|CategoryA 02|CategoryB 03|CategoryC and a table that references the Categories and also has a column storing some random number. TABLE:CategoriesAndNumbers CategoryType|Number CategoryA|24 CategoryA|22 CategoryC|105 .....(20,000 records) CategoryB|3 Now, how do I filter out this data? So, I want to know what the 3 smallest numbers are out of each category and delete the rest. The end result would be like this: