Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Sakura
Creator
Creator

Join table from one SQL connection to other SQL connection

I want to join one table from one sql connection to other.

What I did is like :

---------------------------------------

Plant:

sql select Plantcode, Keyid from plants

ODBC CONNECT 32 TO SQLConnection2

Right join(Plant)

query2:

select Keyid, * from table1

---------------------------------

I have to get plantcode from plants to query2. This code is not working. Please help!!

1 Solution

Accepted Solutions
Anil_Babu_Samineni

What if you load second connection into first one

ODBC CONNECT 32 TO SQLConnection2;

ODBC CONNECT 32 TO SQLConnection1;

query2:

select Keyid, * from table1;

Right join(Plant)

Plant:

sql select Plantcode, Keyid from plants

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

3 Replies
Anil_Babu_Samineni

Where is the first connection, And cnnection always shold start from first line (I meant you have to declare before SELECT statement) or else please post full script

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Sakura
Creator
Creator
Author

Apologies Anil but I cannot post the qvw. The script is really big and the connection is defined above the 1st query.

---------------------------------------

ODBC CONNECT 32 TO SQLConnection1

Plant:

sql select Plantcode, Keyid from plants

ODBC CONNECT 32 TO SQLConnection2

Right join(Plant)

query2:

select Keyid, * from table1

---------------------------------

Anil_Babu_Samineni

What if you load second connection into first one

ODBC CONNECT 32 TO SQLConnection2;

ODBC CONNECT 32 TO SQLConnection1;

query2:

select Keyid, * from table1;

Right join(Plant)

Plant:

sql select Plantcode, Keyid from plants

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful