Sorry for the garbage title, but hopefully this will explain:
Given a table
name | data --------------------- 1 | 1000 1 | 2000 1 | 3000 2 | 1500 2 | 2500 2 | 3500
I want to be able to select the top (x) for all names sorted by data value. Therefore, if x = 2, then the return will be
name | data --------------------- 1 | 2000 1 | 3000 2 | 2500 2 | 3500
source share