List:MySQL on Win32« Previous MessageNext Message »
From:Paul DuBois Date:January 9 2001 2:30pm
Subject:RE: SQL...
View as plain text  
At 9:56 AM +0100 1/9/01, Luc Van der Veken wrote:
>  > From: Frank M. Betz, Jr. [mailto:fbetz@stripped]
>>  Sent: Monday 08 January 2001 6:11
>>
>>  if that works that's unbelievable.  I always thought you
>>  could only move
>>  data from table to table from the same database not from two
>>  different ones.
>>  How do you establish a connection to two at the same time
>>  through straight
>>  SQL?
>
>You have a connection to a server, not to a database, and a server can carry
>more than one database (in fact, most of them should: your own database(s)
>and its own MySQL database with info about databases, tables and users).
>
>I find it unbelievable that in this whole thread, nobody actually tried it
>after that first message ;-)

???

In fact, I did try it before posting my INSERT INTO ... SELECT FROM
example.  Your example below (CREATE TABLE ... SELECT FROM) also works,
but only if you have MySQL 3.23 or higher.

>
>mysql> create database test1;
>Query OK, 1 row affected (0.00 sec)
>
>mysql> create database test2;
>Query OK, 1 row affected (0.00 sec)
>
>mysql> use test1;
>Database changed
>mysql> create table test (txt varchar(20));
>Query OK, 0 rows affected (0.02 sec)
>
>mysql> insert into test values('Line1'),('Line2'),('Line3');
>Query OK, 3 rows affected (0.00 sec)
>Records: 3  Duplicates: 0  Warnings: 0
>
>mysql> use test2;
>Database changed
>mysql> create table tst2 select * from test1.test;
>Query OK, 3 rows affected (0.00 sec)
>Records: 3  Duplicates: 0  Warnings: 0



-- 
Paul DuBois, paul@stripped
Thread
Danger! Will Robinson - NewbieSteve Mills7 Jan
  • Re: Danger! Will Robinson - NewbieJohn Dean7 Jan
    • SQL...jed7 Jan
RE: SQL...Rasmus Nyström7 Jan
  • Re: SQL...Jr. Frank M. Betz8 Jan
    • Re: SQL...Paul DuBois8 Jan
      • Re: SQL...Nick Tentomas8 Jan
        • Re: SQL...Paul DuBois8 Jan
    • RE: SQL...Luc Van der Veken9 Jan
      • Re: SQL...jed9 Jan
        • Re: SQL...Paul DuBois9 Jan
      • Re: SQL...Stephen Woodbridge9 Jan
        • RE: SQL...Luc Van der Veken10 Jan
          • Re: SQL...jed10 Jan
      • Re: SQL...jed9 Jan
      • RE: SQL...Paul DuBois9 Jan
      • Re: SQL...jed9 Jan
  • Re: SQL...jed8 Jan
  • Re: SQL...jed8 Jan
    • Re: SQL...Tim Endres8 Jan
      • Re: SQL...Paul DuBois9 Jan
    • Re: SQL...Paul DuBois9 Jan