SQL question.... Trying to improve upon my PHP solution.

2004-11-29 Thread Mike Zornek
I have a table of members, about 13,000 rows. Each night I need to shuffle the table. I have a small int column called random_position. Currently I am creating a position list (based on the count of the members), shuffle it, then while iterating through the members assigning them a a position.

Re: SQL question.... Trying to improve upon my PHP solution.

2004-11-29 Thread mos
At 11:08 AM 11/29/2004, you wrote: I have a table of members, about 13,000 rows. Each night I need to shuffle the table. I have a small int column called random_position. Currently I am creating a position list (based on the count of the members), shuffle it, then while iterating through the

Re: SQL question.... Trying to improve upon my PHP solution.

2004-11-29 Thread Mike Zornek
On 11/29/04 12:27 PM, mos [EMAIL PROTECTED] wrote: Mike, Your solution is way too complicated (it makes my head hurt).g Try this: set @n=0; update tmp set rnd = @n := @n + 1 order by RAND() Mike I'll give this a shot. Follow-up question: I've had a lot of trouble with RAND() on

Re: SQL question.... Trying to improve upon my PHP solution.

2004-11-29 Thread Rhino
- Original Message - From: Mike Zornek [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, November 29, 2004 12:08 PM Subject: SQL question Trying to improve upon my PHP solution. I have a table of members, about 13,000 rows. Each night I need to shuffle the table. I have

Re: SQL question.... Trying to improve upon my PHP solution.

2004-11-29 Thread Mike Zornek
On 11/29/04 1:26 PM, Rhino [EMAIL PROTECTED] wrote: I don't think this is a question about SQL at all; I think you already know how to write the SQL to select, insert, update or delete rows. I think that what you really want to know is if there is a more efficient way to shuffle your rows

Re: SQL question.... Trying to improve upon my PHP solution.

2004-11-29 Thread mos
At 11:53 AM 11/29/2004, you wrote: On 11/29/04 12:27 PM, mos [EMAIL PROTECTED] wrote: Mike, Your solution is way too complicated (it makes my head hurt).g Try this: set @n=0; update tmp set rnd = @n := @n + 1 order by RAND() Mike I'll give this a shot. Follow-up question: I've had a