LEFT JOIN operation when the tables are in two separate databases - mysql

I want to perform Left Outer Join on two tables where the tables are in two separate data bases ( i.e., one in Mysql database and One in Oracle database)
Please let me know how to perform this Left join operation in the SELECT Query

Yes you can do a left out join in tableau for tables coming in from two different data sources.
In order to accomplish this you need to create two different data connections under the same data source. Follow below steps:
Create a connection to any required database.
Under connection on right side click on Add
Connect to the second database.
Drag and drop tables from both database to right side.
create the desired outer joins.

Related

Pentaho-spoon Specify mysql connection without database name (for Multiple database access)

I have a scenario where I have two separate databases olap and oltp, in the input-table or scripting(mysql) I want to join tables from these two different databases.
I am not able to leave database column blank when creating a connection, so I can't access both database (and join tables).
One solution suggested in an answer is to put variables in kettle.properties. but I am not sure how can I access those variables inside SQL query( will syntax like this ${} work in SQL?)
Try this:
Choose one database name in the connection.
In the Table input step:
SELECT
table1.field1
, table2.field2
FROM [database1].[schema].table1
INNER JOIN [database2].[schema].table2
If that doesn't work try having two table input ( one for each database ) make sure they are sorted on the column you'll use as a key in the JOIN and use a Merge Join step as shown here:

JOIN tables from different dbs

I need to fix a query that used to join different tables residing in the same db. Now some of the tables were moved to a different db, while on the same server. Is there a way to modify the query to indicate where each table is?

how can I inner join 2 mysql tables on 2 different mysql server

I am trying to inner join 2 tables located on 2 different MySQL Servers.
I am trying to do something like this:
SELECT id, name FROM server2.db1.account AS new_data
INERT INTO server1.db2.account(id, name)
ON DUPLICATE KEY UPDATE name = new_data.name
In SQL Server there is link server future which allows you to do this but I am not sure how this is done using MySQL Server.
Note: I need to be able to inner join all the tables from one server to another.
I am looking for a solution where I don't have to do every table separately as I have multiple servers and many tables on each database.
Thanks for your time and help.
Go read about the federated engine. It is the MySQL version of linked servers. You will be able to query a remote table like a local table using the federated engine. Read this link.

Is it possible to get information from different database with inner join having database in SQL and mySql?

I have my project A with mySql database and I have another project B with msSql. I have connected the database from A and fetched data from B. But now I need to use inner join for tables in A and B. Is it possible to do so with databases in the same server and different server? Any help will be appreciated.
Thanks in advance
Yes, it should be possible. First, you will need to link your MySQL server to your MS SQL Server.
See this reference. Secondly, you will probably need to use sub queries to select the correct columns and do the join on them;
SELECT *
FROM
(SELECT ms_column1, ms_column2 FROM MSSQLTABLE) AS mssql
JOIN
(SELECT my_column1, my_column2
FROM openquery(LINKED_SERVER, 'SELECT column1, column2 FROM MYSQLTABLE') AS mysql
ON mssql.ms_column1 = mysql.my_column1
Unfortunately untested.
Instead of making the two different databases communicate between themselves you can move the logic of the communication to the programming layer. For example using PDO and PHP you can connect to both databases, get the data, mix it and produce a result. You can create an abstraction layer of PHP classes that get information independently from A or B databases, and later you will not care anymore about it, as you will work with PHP objects not directly with databases.

SQL to ACCESS 2010

I imported my SQL information into Access. How can I create a table in Access, then join or link it to an existing table already in Access 2010.
I just use 'Access Data Projects' (ADP). This allows me to keep everything on the SQL Server side, and it allows me to write stored procedures (and bind them to forms, etc) without writing mountains of linked table / SQL passthrough code.
An easy way is to set up a UNION query. That will leave your two tables intact but join the data.
A JOIN query would merge the data into one of the existing tables.
http://stackoverflow.com/questions/38549/difference-between-inner-and-outer-joins post has some good info about that.