There are only 8,000 rows.  Unfortunately, I was really hoping for some 
sort of function within MySQL to do this.  I'm not using PHP, but rather 
Perl.  I could pretty much do the same thing in Perl, I guess.  Is there 
any elegant solution or alternative within MySQL?
On Friday, July 20, 2001, at 04:43 PM, Werner Stuerenburg wrote:

> How many rows do you have? I'd do it in php along those lines:
> read the rows from the old table in 3 arrays. randomize one or
> all of them (built in function in version 4, else do it
> yourself), then populate new table from those arrays.
>
> Sie schrieben am Freitag, 20. Juli 2001, 23:56:38:
>
>> I'm sure I'm just missing something basic, but here goes...
>
>> I need to create a table, populated with data, from an existing table.
>> Easy enough:
>> "create table TEST select * from OLD_DATA"
>
>> Most cool.  Now, let's say OLD_DATA has three columns: A, B, & C.  I
>> want to create new table TEST, with all 3 columns from OLD_DATA,
>> but.....I want to totally randomize the order of column B.  For 
>> example,
>> I want to go from:
>
>> FIRSTNAME               LASTNAME                PID
>> bob                             jones                   1
>> mary                            smith                   2
>> maddog                  brown                   3
>
>> To this:
>
>> FIRSTNAME               LASTNAME                PID
>> bob                             smith                   1
>> mary                            brown                   2
>> maddog                  jones                   3
>
>> I guess what I'm looking for is something similar to this imaginary
>> command:
>
>> CREATE TABLE TEST SELECT FIRSTNAME, PID, (LASTNAME ORDER BY RAND()) 
>> FROM
>> OLD_DATA;
>
>> Any help is appreciated.
>
>
>> ---------------------------------------------------------------------
>> Before posting, please check:
>>    http://www.mysql.com/manual.php   (the manual)
>>    http://lists.mysql.com/           (the list archive)
>
>> To request this thread, e-mail <[EMAIL PROTECTED]>
>> To unsubscribe, e-mail <mysql-unsubscribe-ws=art-
>> [EMAIL PROTECTED]>
>> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>
>
> --
> Herzlich
> Werner Stuerenburg
>
> _________________________________________________
> ISIS Verlag, Teut 3, D-32683 Barntrup-Alverdissen
> Tel 0(049) 5224-997 407 · Fax 0(049) 5224-997 409
> http://pferdezeitung.de
>
>

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to