Possible Duplicate:
Selecting the top n rows within a group by clause
I have the following data:
id actionid commentid
1 1 1
2 1 2
3 1 3
4 2 1
I want to create a sql to only show the top 2 comments for each actionid. In that case I the sql should only return id (1,2,4)
Thanks
1 Answer