Boryniec Adam wrote:
> 
> Hello,
> 
> I have a following problem:
> I created two simple tables and a query that uses both of
> them. This works perfectly. See the example below.
> The question is: is the same query possible when the two
> tables are located in diffrent databases.
> What I mean: Is it possible to write a crossdatabase
> queries in MySQL?

Yes, it is. Just use "select db_name.tbl_name.fld, ... from db_name,
...."


> 
> thank you in advance
> Adam
> 
> create table FIELD_DESC (
>   field_id SMALLINT NOT NULL,
>   description VARCHAR (80),
>   PRIMARY KEY (field_id)
> );
> 
> insert into FIELD_DESC (field_id,description)
>        values (1,"Description of the field \"First name\" on the user registration 
>page");
> insert into FIELD_DESC (field_id,description)
>        values (2,"Description of the field \"Last name\" on the user registration 
>page");
> 
> create table FIELD_TXT (
>   language_id SMALLINT NOT NULL,
>   field_id SMALLINT NOT NULL,
>   text_value VARCHAR(30),
>   PRIMARY KEY (language_id,field_id)
> );
> 
> insert into FIELD_TXT (language_id,field_id,text_value)
>        values (1,1,"Vorname:");
> insert into FIELD_TXT (language_id,field_id,text_value)
>        values (2,1,"First name:");
> insert into FIELD_TXT (language_id,field_id,text_value)
>        values (1,2,"Nachname:");
> insert into FIELD_TXT (language_id,field_id,text_value)
>        values (2,2,"Last name:");
> 
> SELECT fd.description, ft.text_value
>    FROM FIELD_DESC fd, FIELD_TXT ft
>    WHERE fd.field_id = ft.field_id;
> 
> ---------------------------------------------------------------------
> 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

Reply via email to