You can translate the question and the replies:

How can I select random rows from a table (without replacement) with VQL?

For example, how do I select 10 random rows from a table, `foo`? I would expect this to work ``` select *, rand() as rank from foo order by rank limit 10 ``` but `rand()` generates a **single** random value which it then maps to every record in `foo`. So, this query returns the same exact 10 rows every time.
VQL
user
29-04-2022 16:29:44 -0400

3 Answers

Hi, I tried a very similar query and could make it work on a base view from an Oracle data source. The query I have used is: ``` select * from foo order by rand() limit 10 ``` Hope that helps!
Denodo Team
04-05-2022 10:37:15 -0400
@Denodo Team Thanks for the reply. Just to be clear, when you run your query twice in a row, you get two different row-sets, yes?
user
04-05-2022 10:39:59 -0400
Hello, Yes, I tried the query multiple times, different sets returned each time. Hope this helps!
Denodo Team
05-05-2022 04:12:20 -0400
You must sign in to add an answer. If you do not have an account, you can register here