Thanks for the suggestion! I should have been more specific -- I don't need
to do this as a bulk import. I need to do these on an ongoing basis. It
doesn't have to be super-fast, though. I would expect something on the
order of tens of events per hour at the most.
> Given my crude understanding of the tools I would suggest doing a SELECT
> INTO a text file of the fields you want in the 2nd DB and then using
> mysqlimport to import the text file into the 2nd DB....the fields need to be
> in the same order as the text file. This could be automated with a script
> that passes mysql the SELECT INTO script and then execute the mysqlimport
> command. Crude but ...
>
> Trying to be helpful....
> ----- Original Message -----
> From: "Michael J. Kobb" <[EMAIL PROTECTED]>
> To: "MySQL" <[EMAIL PROTECTED]>
> Sent: Monday, April 30, 2001 10:24 PM
> Subject: Re: Fundamental (newbie) question
>
>
>> Unfortunately, I have no option to redesign database A. It's from a third
>> party. I could potentially redesign database B somewhat, but I think
> there
>> would be one table with 30+ columns no matter what.
>>
>> For instance, I could precisely duplicate the fields from the table in
>> database A in a table in database B. But, the crux still remains -- is
>> there some simple way to copy data from one database to another if the
>> fields are the same?
>>
>> Thanks!
>>
>>>
>>> Well, first of all, you may want to consider redesigning your two
>>> databases. Most properly designed databases don't have 52 columns in a
>>> table. The process of normalization should decompose these tables
> further
>>> and make things way less complex. I don't know what the context of your
>>> databases are, but you might be able to treat 'Purchases' in Database B
> as
>>> a separate entity, for example.
>>>
>>> Unfortunately, I'm in the midst of learning MySQL myself, so I don't
> have
>>> any insight on your real question....plus, it's time for bed. But I
> think
>>> if you take some time redesigning the databases, you'll find your
> problems
>>> are not as complex...
>>>
>>> Good luck!
>>>
>>> - TIM FRASER
>>>
>>>> Please forgive the relatively basic nature of this question. I'm new
> at
>>>> this. I have the DuBois MySQL book and the O'Reilly one as well, so
> please
>>>> feel free to point me at a page number. I couldn't find the answer
> myself.
>>>>
>>>> I have two databases. Database A has a few tables, and the table of
>>>> interest has about 35 columns.
>>>>
>>>> Database B also has a few tables, and one of them has about 52 columns.
> 35
>>>> of those 52 are exactly the same as the ones in the table in Database
> A.
>>>> One could think of the data in Database B almost as a C++ subclass of
> the
>>>> data in Database A -- it has all the same fields, plus some extra ones.
>>>>
>>>> Is there a relatively easy way to take a record in Database A and copy
> all
>>>> the matching fields over to a record in Database B?
>>>>
>>>> I wish I could post the exact tables and such, but I can't. Here's a
>>>> simplified version:
>>>>
>>>> Database A, table 1 has:
>>>> Name
>>>> Address
>>>> Phone
>>>> Birthday
>>>>
>>>> Database B, table 1 has:
>>>> Name
>>>> Address
>>>> Phone
>>>> Birthday
>>>> Purchases
>>>> Account balance
>>>>
>>>> I would like to be able to easily make a new record in database B,
> copying
>>>> over the data from the matching fields in A.
>>>>
>>>> Before you suggest that B should simply point at A, I can't do that
>>>> unfortunately. The data in A "ages out" over time, but the data in B
> needs
>>>> to persist. So, I think the best choice is to copy.
>>>>
>>>> Thanks!
>>>> --Mike
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> Before posting, please check:
>>>> http://www.mysql.com/manual.php (the manual)
>>>> http://lists.mysql.com/ (the list archive)
>>>>
>>>> To request this thread, e-mail <[EMAIL PROTECTED]>
>>>> To unsubscribe, e-mail
>>>> <[EMAIL PROTECTED]>
>>>> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> Before posting, please check:
>>> http://www.mysql.com/manual.php (the manual)
>>> http://lists.mysql.com/ (the list archive)
>>>
>>> To request this thread, e-mail <[EMAIL PROTECTED]>
>>> To unsubscribe, e-mail
> <[EMAIL PROTECTED]>
>>> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>>>
>>
>>
>> ---------------------------------------------------------------------
>> Before posting, please check:
>> http://www.mysql.com/manual.php (the manual)
>> http://lists.mysql.com/ (the list archive)
>>
>> To request this thread, e-mail <[EMAIL PROTECTED]>
>> To unsubscribe, e-mail
> <[EMAIL PROTECTED]>
>> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>>
>>
>
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php