[plug] mysql query questoin
levsky at rave.iinet.net.au
levsky at rave.iinet.net.au
Sun Jan 19 21:53:02 WST 2003
On Sun, Jan 19, 2003 at 09:46:04PM +0800, Jon Miller wrote:
> I guess what I need to know is does MySQL know that the table I want the
> info to go into is in another database, if not how do I tell MySQL this
> information? I can understand if the two (2) tables resides in the same
> database, but they don't.
>
> JLM
>
> On Sun, 2003-01-19 at 21:33, Onno Benschop wrote:
> > On Sun, 2003-01-19 at 21:09, Anne Busby wrote:
> > > Try
> > >
> > > INSERT INTO <table2> SELECT <fields> FROM <table>;
> >
> > And if you don't have field names that don't match-up, then you need to
> > make it so:
> >
> > INSERT INTO table (field1, field2, field3) SELECT peter AS field1, paul
> > AS field2, mary AS field3 FROM table2 WHERE something='fred'
>
I'd personally do that as.
use db2;
INSERT INTO table2 SELECT fields FROM db1.table1
It's worked for me before - in fact, I did it last week with about 78000
rows..
--
Old MacDonald had a form
e_i ^ e_i = 0
More information about the plug
mailing list