RE: Generate random, unique value...

2001-10-29 Thread Carsten H. Pedersen
> You could also do ORDER BY RAND(), which I just discovered in the DuBois > book when looking for the syntax of the RAND() function (which I haven't > used before). For a different take on retrieving random records, check out http://www.bitbybit.dk/mysqlfaq/faq.html#ch7_21_0 / Carsten -- Carst

RE: Generate random, unique value...

2001-10-29 Thread George Eric R Contr AFSPC/CVYZ
>> I'm not sure what the problem with this is? The first (unique) column is >> independent of the second (random) column. If the random column has >> duplicate values, it just means that the corrosponding first column values >> will be adjacent in the sorted table. >If you're really depending o

Re: Generate random, unique value...

2001-10-29 Thread Carl Troein
George Eric R Contr AFSPC/CVYZ writes: > I'm not sure what the problem with this is? The first (unique) column is > independent of the second (random) column. If the random column has > duplicate values, it just means that the corrosponding first column values > will be adjacent in the sorted

RE: Generate random, unique value...

2001-10-29 Thread George Eric R Contr AFSPC/CVYZ
>I can see one problem with this, which is that in the case that you >get two identical number in the second column their order will be >strongly dependent on the values in the first column. I'm not sure what the problem with this is? The first (unique) column is independent of the second (rand

Re: Generate random, unique value...

2001-10-27 Thread Carl Troein
George Eric R Contr AFSPC/CVYZ writes: > How about this: > > Create a table with two columns. The first is autoincrement, so guarenteed > unique. The second is random (but not neccesarily unique). > > Now sort this table by the second column. > The first column, read in order, should now sui

RE: Generate random, unique value...

2001-10-26 Thread George Eric R Contr AFSPC/CVYZ
How about this: Create a table with two columns. The first is autoincrement, so guarenteed unique. The second is random (but not neccesarily unique). Now sort this table by the second column. The first column, read in order, should now suit your needs, but I don't think you can do inserts auto

Re: Generate random, unique value...

2001-10-26 Thread Bill Adams
Kyle Hayes wrote: > On Friday 26 October 2001 10:00, Dana Holt wrote: > > Can I automatically generate a random, unique, integer value in a certain > > range when inserting data into a column using SQL? > > > > If so, how? > > Random is easy. Just find a good RNG (random number generator) somewh

Re: Generate random, unique value...

2001-10-26 Thread Kyle Hayes
On Friday 26 October 2001 10:00, Dana Holt wrote: > Can I automatically generate a random, unique, integer value in a certain > range when inserting data into a column using SQL? > > If so, how? Random is easy. Just find a good RNG (random number generator) somewhere (there are many available o

RE: Generate random, unique value...

2001-10-26 Thread Shankar Unni
Dana Holt writes: > Can I automatically generate a random, unique, integer value > in a certain range when inserting data into a column using SQL? "Random"? Like how "random"? * Math.random() random? And still unique? That's really tough.. * Or just "you don't care, but not sequential" "rando