On Tuesday 24 January 2006 12:03, Gleb Paharenko wrote:
> 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

Thanks a lot. That did the trick. I ended up with a command like this:

update newdb.table as T,olddb.table as S set T.foo=S.foo,T.bar=S.bar,...(more 
fields that should be copied) where T.id=S.id;

-- 
Jørn Dahl-Stamnes
homepage: http://www.dahl-stamnes.net/dahls/

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

Reply via email to