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?
Related
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:
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.
In Linqpad how can I query against two databases on one query.
I have managed to add the 2 databases like so:
https://stackoverflow.com/a/4928921/66975
so the connection says "db1 + db2".
However I am unsure how to access the tables from db2 to make queries.
I can query against tables in the first db.
Note: both dbs contain more or less the same table names.
I have a database that is used to create a data file for a customer. The database has two linked tables that are linked to tables that are both in another database (but within the same database as each other). Their structure is identical.
I have a union query set up to combine both linked tables.
I am using a Macro to export that query but after running for a short while I get the error "The query cannot be completed. Either the size of the query set....."
Does Access have a limitation on union query size? Combined, the tables are a lot of data but I'm confused as both the tables I'm combining are in the same database.
It transpires that in my case I should be using Union All instead of Union as there will never be duplicates in the two tables I'm combining.
It appears that the de-duplication of the tables is what was taking up memory.
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.