I need to execute a Query(Select only) with join of two tables from different database of same server.
Eg query will be similar to:
SELECT * FROM DB1.tbl_a LEFT JOIN DB2.tbl_b ON DB1.tbl_a.fieldX = DB2.tbl_b.fieldY WHERE ....
Where tbl_a,tbl_b are 2 tables from 2 different database DB1,DB2 respectively
How to do that? How can I connect to MySQL server without specifying the database in the connection string but in sql query Using C#.?
Actually this question has already been answered, here is the answer :
Yes, assuming the account has appropriate permissions you can use:
You just need to prefix the table reference with the name of the database it resides in.