Cross-Database Joins
👤 This documentation is intended for SQL Users. SQL Users will need to reach out to their Site administrators to ensure tables are cached within Sisense.
Note: Cross-Database Joins are only available with the Cache or Warehouse Infrastructure.
In a cross-database join, Sisense pulls information from tables across multiple data sources, as if they existed within the same database. In order to perform a cross-database join, all of the tables in the query must exist on the Sisense Cache. Customers on MySQL and SQL Server may already be familiar with cross-database joins for databases that are on the same host.
Depending on whether the data is cached in the Redshift Cache or Snowflake Cache, the query must use Redshift-compatible or Snowflake-compatible syntax.
Syntax
Cross database joins use the same syntax as regular single database joins. Using two example database, ExampleOne and ExampleTwo, the example below shows a join between ExampleOne's Dog table in SchemaOne with ExampleTwo's Animal table in SchemaTwo.
![](https://cdn.prod.website-files.com/58fe8f93dc9e750ca84ebb16/5c5ca658a3136e7965580799_Cross%20DB%201.png)
Table names can also be aliased to clear up some ambiguity:
![](https://cdn.prod.website-files.com/58fe8f93dc9e750ca84ebb16/5c5ca6500a3f27637ac06b37_Cross%20DB%20join%202.png)
Errors
If an error is returned while trying to do a cross-database join, ensure that the syntax is Redshift-compatible or Snowflake-compatible depending on the cache infrastructure being used. Ask your Site Administrator to verify that all the tables used in the join are cached.