db2 select x random rows for a given id
<p>If I have two columns - an ID field and a score field that can take 10 possible values, how can I select 5 random rows per ID? I know I can select 5 random rows from a table by using the following:</p>

<pre><code>select *, rand() as idx
from mytable 
order by idx fetch first 5 rows only
</code></pre>

<p>but how about 5 rows per ID?</p>