I'm not really sure that this is what you meant, but I think you could try 
something like:

SELECT INTO my_new_table table1.id as id, table1.direction as direction, 
table2.speed as speed
FROM table1 INNER JOIN table2 ON table1.id = table2.id

I don't know if MySQL supports INNER JOIN (I suppose it does) but if it 
doesn't replace the FROM clause with:
table1, table2 WHERE table1.id = table2.id

this should create a new table (called my_new_table) with 3 columns (id, 
direction and speed) with the value of 'id' and 'direction' from table1 and 
the value of 'speed' from table2 where the 'id' of table1 and table2 match.


At 10:58 PM 10/10/2001 +0100, [EMAIL PROTECTED] wrote:
>Dear All,
>
>Using MySQL I'm trying to update field1 in table1 with data from field1 in 
>table2 where the primary keys in tables 1 and 2 match. In other words I 
>have 2 tables the first with direction information and the second with 
>speed information both have time as the primary key and what I want is a 
>single TEMPORARY table with the direction and speed indexed by time. Table 
>1 is a copy of the speed information with an extra field to accommodate 
>the direction information.
>
>So far I've tried
>
>$query = qq{SELECT f_dir.t_table1, f_speed.t_table2 WHERE f_time.t_table1 
>=  f_time.t_table2};
>
>while my $hasharray = ....
>
>{
>
>$query = qq{UPDATE...
>
>}
>
>which is very slow (the tables contain 20 000 records).
>
>Another option would be to select the data into a text file, delete 
>existing data from the table1 and bulk load the text file into the table, 
>which seems extremely clumsy.
>
>Is there an option I've missed?
>
>Ta,
>Scott

                 Javier Dussaillant G.
                 [EMAIL PROTECTED]
                 Departamento de Desarrollo VRWEB ltda.
                 http://www.vrweb.cl

Reply via email to