# Creating a multi-database query

**URL:** <https://forum.inductiveautomation.com/t/creating-a-multi-database-query/76328>\
**Category:** Ignition\
**Created:** [July 13, 2023, 2:28pm UTC](https://forum.inductiveautomation.com/t/creating-a-multi-database-query/76328 "2023-07-13T14:28:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![t.cobbs](https://avatars.discourse-cdn.com/v4/letter/t/50afbb/32.png) [@t.cobbs](https://forum.inductiveautomation.com/u/t.cobbs)\
**Post date:** [July 13, 2023, 2:28pm UTC](https://forum.inductiveautomation.com/t/creating-a-multi-database-query/76328/1 "2023-07-13T14:28:50Z")

</div>

I am trying to create a query that can pull from two different database connections. Is it possible to do that in a named query or in a script on a table. What would the syntax look like?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [July 13, 2023, 2:29pm UTC](https://forum.inductiveautomation.com/t/creating-a-multi-database-query/76328/2 "2023-07-13T14:29:42Z")

</div>

Not possible. You’ll have to merge the results of two different queries somehow.

---

<div class="post-metadata">

**Author:** ![t.cobbs](https://avatars.discourse-cdn.com/v4/letter/t/50afbb/32.png) [@t.cobbs](https://forum.inductiveautomation.com/u/t.cobbs)\
**Post date:** [July 13, 2023, 2:38pm UTC](https://forum.inductiveautomation.com/t/creating-a-multi-database-query/76328/3 "2023-07-13T14:38:45Z")

</div>

Is there any chance this feature will be added in later on?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [July 13, 2023, 2:40pm UTC](https://forum.inductiveautomation.com/t/creating-a-multi-database-query/76328/4 "2023-07-13T14:40:23Z")

</div>

No, it fundamentally isn’t possible. You can’t select columns or join tables or expect one database to understand references to a table or columns in another.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [July 13, 2023, 3:06pm UTC](https://forum.inductiveautomation.com/t/creating-a-multi-database-query/76328/5 "2023-07-13T15:06:48Z")

</div>

Not in Ignition, at least.

You can either

1. Push the 'join' logic into scripting, using your own logic you write
2. Use a DB-specific technology (e.g. PostgreSQL offers 'foreign data wrappers') to let one DB connection (in Ignition) act as a proxy to more than one external DB. In this case the DB you're connecting to is in charge of managing joins, and there may be catastrophic performance cliffs or other issues. You're on your own.
