Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 18035

Get top results for each group (in Oracle)

$
0
0

How would I be able to get N results for several groups inan oracle query.

For example, given the following table:

|--------+------------+------------|| emp_id | name       | occupation ||--------+------------+------------||      1 | John Smith | Accountant ||      2 | Jane Doe   | Engineer   ||      3 | Jack Black | Funnyman   ||--------+------------+------------|

There are many more rows with more occupations. I would like to getthree employees (lets say) from each occupation.

Is there a way to do this without using a subquery?


Viewing all articles
Browse latest Browse all 18035

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>