I am using Oracle 11gR2. Given a table, I would like to return a certain number of rows in random order, with potential duplicates.
All the posts I have seen (here or here or here also) are about finding a number of unique rows in random order.
For example, given this table and asking for 2 random rows:
Table
-----------------
ID LABEL
1 Row 1
2 Row 2
3 Row 3
I would like the query to return
1 Row 1
2 Row 2
but also possibly
1 Row 1
1 Row 1
How could this be done using only pure SQL (no PL/SQL or stored procedure) ? The source table does not have duplicate rows; by duplicate, I mean two rows having the same ID.
Aucun commentaire:
Enregistrer un commentaire