[plug] mysql query questoin
Jon Miller
jlmiller at mmtnetworks.com.au
Sun Jan 19 21:42:26 WST 2003
Which is exactly the case.
The destination table is in another database and the tables in this db
have differently named fields. I was hoping there is a way to say
INSERT INTO (Destination database.table, field1, field2, etc) SELECT
(field1, field2, etc) FROM (source table).
The problem lies in the syntax to insert data in a different database
table and fields.
I 'm thinking run the query and save the results in a file that can be
read into the destination datebase table. However, I do not know how to
save the results in the file format that MySQL can read. But I do know
if the file is formatted properly, MySQL can import the data from the
file.
Jon
On Sun, 2003-01-19 at 21:26, Denis Brown wrote:
> Jon,
>
> I believe this is a little akin to "piping" data. For example "SELECT
> bah blah blah" gets the data and INSERT whatever, whatever, whatever does
> the insert. So you'd be looking at a syntax like...
>
> INSERT INTO (your destination table) SELECT (your query string) FROM
> (your source table);
>
> Pending a more informed reply, that's where I'd be headed. It could of
> course get tricky if you need to send data to differently-named fields.
>
> HTH,
> Denis
>
>
> On 19 Jan 2003, Jon Miller wrote:
>
> > I'm trying to do a query in mysql whose results I want to put in another
> > mysql database/table.
> > The query part I have that correct as the results are right, from there
> > I'm lost. Does anyone know who this is suppose to work?
> > is it the SELECT .... INSERT syntax?
> >
> > Thanks
> > --
> > Jon Miller <jlmiller at mmtnetworks.com.au>
> > MMT Networks Pty Ltd
> >
> >
> >
>
--
Jon Miller <jlmiller at mmtnetworks.com.au>
MMT Networks Pty Ltd
More information about the plug
mailing list