Re: Creating random data in a test table based on an existing tab le

2003-11-13 Thread Olof Tjerngren
Hi,

I tried it in 4.0 and got the desired result - but at least the select 
part should not depend on version, as long as it's recent.

The select should return all combinations of first and last names 
available in the source table ordered by random to be more interesting.
You can try that by itself to see what it returns. If the select gives 
more rows you'll have to find some other way of inserting the data into 
the test table.
The only way it should return only one row is if you have only one row 
in the source data, if you have two rows it should be four lines 
returned, and so on.

MvH,

Luis Lebron wrote:

Thanks for the help. I tried your suggestion but only got 1 row 
inserted in the test table.

Luis

-Original Message-
From: Olof Tjerngren [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 11, 2003 3:01 AM
To: Luis Lebron
Cc: Mysql (E-mail)
Subject: Re: Creating random data in a test table based on an existing
table
How about somethine like this as a starting point:

insert into testuser (firstname,lastname) select
u1.firstname,u2.lastname from user u1, user u2 order by rand() limit 
1;

MvH,

Luis Lebron wrote:
 I have an users table for a php application that I am programming. The
 current users table has about 1500 records. I would like to create a 
test
 table (i.e. users_test) with 10,000 records based on random data 
from the
 first table (i.e. random first name combined with a random last name,
 etc...). Is it possible to do this via a MySQL query?

 Luis R. Lebron
 Sigmatech, Inc




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Creating random data in a test table based on an existing table

2003-11-11 Thread Olof Tjerngren
How about somethine like this as a starting point:

insert into testuser (firstname,lastname) select 
u1.firstname,u2.lastname from user u1, user u2 order by rand() limit 1;

MvH,

Luis Lebron wrote:
I have an users table for a php application that I am programming. The
current users table has about 1500 records. I would like to create a test
table (i.e. users_test) with 10,000 records based on random data from the
first table (i.e. random first name combined with a random last name,
etc...). Is it possible to do this via a MySQL query? 

Luis R. Lebron
Sigmatech, Inc


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]