Hello.

If dbA.id has the format you have specified MySQL should be able to
silently convert the type from char to int, and you can work with dbA.id
as it is integer column.


mysql> create table ch(id char(6));
Query OK, 0 rows affected (0.04 sec)

mysql> insert into ch set id='001234';
Query OK, 1 row affected (0.00 sec)

mysql> select id+0 from ch;
+------+
| id+0 |
+------+
| 1234 |
+------+

Use something similar to:
 update dbB, dbA set dbB.foo=dbA.foo, dbB.bar=dbA.bar where
 dbB.id=dbA.id ;

See:
  http://dev.mysql.com/doc/refman/5.0/en/update.html



Jørn Dahl-Stamnes wrote:
> Assume that you have two tables (in two different databases):
> 
> table A in database dbA:
> ------------------------
> id    CHAR(6)
> foo   int
> bar   int
> 
> table B in database dbB:
> ------------------------
> id    INT(6)
> foo   int
> bar   int
> 
> Both tables has a several records with identical ID values, but the format is 
> different ('001234' vs 1234).
> 
> Is it possible to create a update query that copies the 'foo' and 'bar' from 
> table dbA.A to dbB.B for each record in dbB.B?
> 


-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Gleb Paharenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.NET
       <___/   www.mysql.com

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

Reply via email to