Re: Using RAND to get a unique ID that has not been used yet

2010-05-28 Thread Jim Lyons
If your specs are that specific (IDs must be between 1 and 99) then you could create a 99-row table with one integer column and prefill it with the numbers 1 to 99 in random order. Then you could write a function that would select and return the first number in the table, then delete

RE: Using RAND to get a unique ID that has not been used yet

2010-05-28 Thread Steven Staples
-Original Message- From: Jim Lyons [mailto:jlyons4...@gmail.com] Sent: May 28, 2010 11:49 AM To: Andre Matos Cc: mysql@lists.mysql.com Subject: Re: Using RAND to get a unique ID that has not been used yet If your specs are that specific (IDs must be between 1 and 99) then you could create

Re: Using RAND to get a unique ID that has not been used yet

2010-05-28 Thread Andre Matos
[mailto:jlyons4...@gmail.com] Sent: May 28, 2010 11:49 AM To: Andre Matos Cc: mysql@lists.mysql.com Subject: Re: Using RAND to get a unique ID that has not been used yet If your specs are that specific (IDs must be between 1 and 99) then you could create a 99-row table with one integer

RE: Using RAND to get a unique ID that has not been used yet

2010-05-28 Thread Jerry Schwartz
-Original Message- From: Jim Lyons [mailto:jlyons4...@gmail.com] Sent: Friday, May 28, 2010 11:49 AM To: Andre Matos Cc: mysql@lists.mysql.com Subject: Re: Using RAND to get a unique ID that has not been used yet If your specs are that specific (IDs must be between 1 and 99) then you

RE: Using RAND to get a unique ID that has not been used yet

2010-05-28 Thread Jerry Schwartz
-Original Message- From: Andre Matos [mailto:andrema...@mineirinho.org] Sent: Friday, May 28, 2010 1:44 PM To: Steven Staples Cc: mysql@lists.mysql.com Subject: Re: Using RAND to get a unique ID that has not been used yet It seems to be a good approach, although I was trying to get

Re: Using RAND to get a unique ID that has not been used yet

2010-05-28 Thread Andre Matos
...@mineirinho.org On 2010-05-28, at 1:51 PM, Jerry Schwartz wrote: -Original Message- From: Andre Matos [mailto:andrema...@mineirinho.org] Sent: Friday, May 28, 2010 1:44 PM To: Steven Staples Cc: mysql@lists.mysql.com Subject: Re: Using RAND to get a unique ID that has

Re: Using RAND to get a unique ID that has not been used yet

2010-05-28 Thread Perrin Harkins
On Fri, May 28, 2010 at 11:38 AM, Andre Matos andrema...@mineirinho.org wrote: I have a table that uses auto_increment to generate the Id automatically working fine. However, I need to create a new table where the Id must be a number generated randomly, so I cannot use the auto_increment.

Re: Using RAND to get a unique ID that has not been used yet

2010-05-28 Thread Kevin (Gmail)
- From: Jerry Schwartz je...@gii.co.jp To: 'Andre Matos' andrema...@mineirinho.org; 'Steven Staples' sstap...@mnsi.net Cc: mysql@lists.mysql.com Sent: Friday, May 28, 2010 6:51 PM Subject: RE: Using RAND to get a unique ID that has not been used yet -Original Message- From: Andre Matos

RE: Using RAND()

2002-05-07 Thread Gurhan Ozen
You have to have MySQL 3.23 or greater.. http://www.mysql.com/doc/M/a/Mathematical_functions.html Gurhan -Original Message- From: Cummings, Shawn (GNAPs) [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 07, 2002 11:33 AM To: [EMAIL PROTECTED]; Ulf Harnhammar Cc: [EMAIL PROTECTED] Subject:

Re: Using RAND()

2002-05-07 Thread webmaster
: [EMAIL PROTECTED] Sent: Tuesday, May 07, 2002 5:11 PM Subject: RE: Using RAND() You have to have MySQL 3.23 or greater.. http://www.mysql.com/doc/M/a/Mathematical_functions.html Gurhan -Original Message- From: Cummings, Shawn (GNAPs) [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 07

Re: Using RAND()

2002-05-07 Thread Paul DuBois
At 11:32 -0400 5/7/02, Cummings, Shawn (GNAPs) wrote: The RAND() syntax does not appear to be working for me. What version mySQL is required? 3.23.2. Prior to that, use SELECT something, any_col*0+RAND() AS r FROM sometable WHERE ... ORDER BY r LIMIT 10 At 04:43 PM 1/29/2002 +0200, Michael

RE: Using RAND()

2002-05-07 Thread Gurhan Ozen
Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 07, 2002 12:55 PM To: [EMAIL PROTECTED] Subject: Re: Using RAND() Hi When I used the RAND() function (MySQL 3.23.45) I found the results were not very random, instead I use an extra bit of php code to make sure