![]() | |
![]() |
| | Thread Tools | Display Modes |
#11
| |||
| |||
|
|
On 2010-09-29 09:57, Willem Bogaerts wrote: - Handle it in code. I don't know what the problem is, but my gut feeling says that is the most logical way to go if your problem involves a "working set". - Create a temporary table based on the SELECT statement. You won't get a random insertion point, but you can solve that by adding an extra field with a position value to the temporary table. - Don't create a temporary table, but create a (unique) position column in the original table. Upon insertion, fill it with a random number. If you get a uniqueness violation, try again with a different random position. Your SELECT query would then be modified to order by the new position column. This is probably the best option if your problem is a permanent randomization like in, for instance, medical trials. Good luck, Thanks for the input Willem. The thing is that since I cannot modify the table or the database I have to store the position information elsewhere. This is a table with some five millions rows so a serialized binary tree with the positions as keys is thinkable. |
![]() |
| Thread Tools | |
| Display Modes | |
| |