Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Differents DataBases in one SELECT
Wed, Mar 29 2006 12:46 PMPermanent Link

Assoes
Hi

It's possible to use diferents Databases in one SELECT

With BDE

SELECT Articles.Codi,Clients.Nom
FROM "Articles",":NewBase:Clients"
WHERE Articles.Codi="000001" AND Articles.Codi=Clients.Codi

This use the Table Articles in Database indicate in Query Componen and
Table Clients indicate in DataBase NewBase (NewBase is the name of
componen DataBase)

Is Possible do this in DbiSam ?


Regards
Robert
Wed, Mar 29 2006 2:17 PMPermanent Link

"GP"
I have a similar problem, I have the following sql script assigned to the
SQL strings of a TDBISAMQuery.  However, in the first sql, ("from myTable1")
myTable1 resides in a  Database/remotedatabasedirectory which is a different
location from the (CompanyCodes) in the second query.

select userid,
if(substring(appldata,6,2)='' then '00' else substring(appldata,6,2)) as
Affiliate,
if(substring(appldata,8,3)='' then '000' else substring(appldata,8,3)) as
ISO
into "\Memory\tempfile"
from myTable1
where applid=101 and substring(appldata,1,5)='X7000';

select a.userid, a.affiliate, a.ISO,
b.AffiliateName, b.IsoName
from "\Memory\tempfile" as a, CompanyCodes as b
where a.affiliate=b.affiliate and a.iso=b.iso;

Any suggestion, anyone?

Thanks,
George Patena

"Assoes" <assoes@assoes.com> wrote in message
news:9AB9FF06-F09B-4EF9-98B6-CF1A51C58FD5@news.elevatesoft.com...
> Hi
>
> It's possible to use diferents Databases in one SELECT
>
> With BDE
>
> SELECT Articles.Codi,Clients.Nom
> FROM "Articles",":NewBase:Clients"
> WHERE Articles.Codi="000001" AND Articles.Codi=Clients.Codi
>
> This use the Table Articles in Database indicate in Query Componen and
> Table Clients indicate in DataBase NewBase (NewBase is the name of
> componen DataBase)
>
> Is Possible do this in DbiSam ?
>
>
> Regards
> Robert

Wed, Mar 29 2006 4:14 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Robert,

<< It's possible to use diferents Databases in one SELECT >>

Yes, just specify the path in the FROM clause:

SELECT *
FROM "c:\temp\mytable" INNER JOIN "c:\mydata\temp" ........

or for remote databases, drop the drive designator and just use the database
name:

SELECT *
FROM "\temp\mytable" INNER JOIN "\mydata\temp" ........

--
Tim Young
Elevate Software
www.elevatesoft.com

Wed, Mar 29 2006 4:34 PMPermanent Link

"GP"
Looking at my problem and your previous post, I found a possible solution,
just prefix the tablename with the databasename, like
"databasename\tablename",

so in your case, it will be something like:

SELECT Articles.Codi, Clients.Nom
FROM "Articles","NewBase\Clients"
WHERE Articles.Codi="000001" AND Articles.Codi=Clients.Codi






"GP" <gp@usa.com> wrote in message
news:939BE508-21C8-45C2-93F5-7963E2DA82EC@news.elevatesoft.com...
>I have a similar problem, I have the following sql script assigned to the
>SQL strings of a TDBISAMQuery.  However, in the first sql, ("from
>myTable1") myTable1 resides in a  Database/remotedatabasedirectory which is
>a different location from the (CompanyCodes) in the second query.
>
> select userid,
> if(substring(appldata,6,2)='' then '00' else substring(appldata,6,2)) as
> Affiliate,
> if(substring(appldata,8,3)='' then '000' else substring(appldata,8,3)) as
> ISO
> into "\Memory\tempfile"
> from myTable1
> where applid=101 and substring(appldata,1,5)='X7000';
>
> select a.userid, a.affiliate, a.ISO,
> b.AffiliateName, b.IsoName
> from "\Memory\tempfile" as a, CompanyCodes as b
> where a.affiliate=b.affiliate and a.iso=b.iso;
>
> Any suggestion, anyone?
>
> Thanks,
> George Patena
>
> "Assoes" <assoes@assoes.com> wrote in message
> news:9AB9FF06-F09B-4EF9-98B6-CF1A51C58FD5@news.elevatesoft.com...
>> Hi
>>
>> It's possible to use diferents Databases in one SELECT
>>
>> With BDE
>>
>> SELECT Articles.Codi,Clients.Nom
>> FROM "Articles",":NewBase:Clients"
>> WHERE Articles.Codi="000001" AND Articles.Codi=Clients.Codi
>>
>> This use the Table Articles in Database indicate in Query Componen and
>> Table Clients indicate in DataBase NewBase (NewBase is the name of
>> componen DataBase)
>>
>> Is Possible do this in DbiSam ?
>>
>>
>> Regards
>> Robert
>
>

Image