# Join 2 tables from different databases

**URL:** <https://forum.inductiveautomation.com/t/join-2-tables-from-different-databases/98734>\
**Category:** Ignition\
**Tags:** database, scripting, perspective\
**Created:** [November 18, 2024, 1:50pm UTC](https://forum.inductiveautomation.com/t/join-2-tables-from-different-databases/98734 "2024-11-18T13:50:00Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [November 18, 2024, 1:55pm UTC](https://forum.inductiveautomation.com/t/join-2-tables-from-different-databases/98734/2 "2024-11-18T13:55:21Z")

</div>

You cannot do this in a single binding. JDBC doesn't have any mechanism to join across different connections. (But some databases can make their own, "foreign", connection, and do this for you.)

If you cannot make one of the databases connect to the other on your behalf, you will need two bindings, and join them yourself.

A script to do the join is a common approach, but I recommend my Integration Toolkit's expression functions for this task.

> [@Automation Professionals' Integration Toolkit Module](https://forum.inductiveautomation.com/t/automation-professionals-integration-toolkit-module/74934/42):
>
> I had some dead time today. Party! Anyways, several new functions: alias() wraps a dataset with a string prefix for each column name nanoTime() just calls java's System.nanoTime() and returns the timestamp. crossJoin() does what you'd think with two datasets. innerJoin() takes two datasets, plus pairs of iterator expressions to match up. leftJoin() as for innerJoin(), but includes a null right row if a row on the left has no match on the right. For Ignition v8.1+: v2.0.6.232…

---

_[View the full topic](https://forum.inductiveautomation.com/t/join-2-tables-from-different-databases/98734)._
