[ale] SQL insert from another database

Chris Fowler cfowler at outpostsentinel.com
Fri Jul 23 20:49:58 EDT 2010


On Fri, 2010-07-23 at 18:38 -0400, Richard Bronosky wrote:
> insert into A.users select NULL AS user_id, name from B.users;
> 
> Because user_id is auto_increment, the NULL will trigger it to
> populate correctly. This is basically the same effect as using
> ()VALUES() as was also suggested.

Yes that was what I was thinking.  I would need to specify each column
and I could simply use a  0 as the key if I wanted too.  Unfortunately
there is a map table that maps rows of a table to a group name.
Typically when i do mass inserts I get the starting key and ending key
and do a base for loop to create a SQL file to do the mass inserts into
the mapping table.  He'll have to figure that one out too.




More information about the Ale mailing list