I have got a situation where i need to get records from database in such a way that, the records should be random form every given N number of records.
Let me explain with example
If the given N be 10 and total records in table be 100 then
i need to fetch one random record from every 10 records present in the table
so total i need 10 records in a way that
1st record from 1-10 records
2nd from 11-20 records
3rd from 21-30
10th from 91-100
Is it possible to get?
Please give me some solution.
Thanks in advance
the problem with your problem is that the rows in a table aren't stored in any particular order
so to get a random row from rows 1-10 means you have to first sort the rows into whatever order you expect, so that you can identify rows 1-10
This topic is now archived. It is frozen and cannot be changed in any way.