# Join two named queries?

**URL:** <https://forum.inductiveautomation.com/t/join-two-named-queries/19976>\
**Category:** Ignition\
**Created:** [October 4, 2018, 10:04am UTC](https://forum.inductiveautomation.com/t/join-two-named-queries/19976 "2018-10-04T10:04:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcarritt1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mcarritt1/32/4262_2.png) [@mcarritt1](https://forum.inductiveautomation.com/u/mcarritt1)\
**Post date:** [October 4, 2018, 10:04am UTC](https://forum.inductiveautomation.com/t/join-two-named-queries/19976/1 "2018-10-04T10:04:10Z")

</div>

Is it possible to Join two named query select statements? Whether in another named query, or in the expression the data parameter of a table?

---

<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:** [October 4, 2018, 12:13pm UTC](https://forum.inductiveautomation.com/t/join-two-named-queries/19976/2 "2018-10-04T12:13:48Z")

</div>

You can put the two bindings on custom properties, then pass them to a script via runScript() that can produce the merged dataset from the input datasets.

---

<div class="post-metadata">

**Author:** ![mcarritt1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mcarritt1/32/4262_2.png) [@mcarritt1](https://forum.inductiveautomation.com/u/mcarritt1)\
**Post date:** [October 4, 2018, 4:55pm UTC](https://forum.inductiveautomation.com/t/join-two-named-queries/19976/3 "2018-10-04T16:55:51Z")

</div>

ahh clever I always forget about doing that trick. Thanks again Phil!

---

<div class="post-metadata">

**Author:** ![dick.willis](https://avatars.discourse-cdn.com/v4/letter/d/7ea924/32.png) [@dick.willis](https://forum.inductiveautomation.com/u/dick.willis)\
**Post date:** [October 3, 2024, 6:03pm UTC](https://forum.inductiveautomation.com/t/join-two-named-queries/19976/4 "2024-10-03T18:03:08Z")

</div>

Could you put a little more meat on those bones?  
I have two named queries ... "A" has a start-time and end-time as parameters, and returns a list of serial and model numbers that were produced during that time, and "B" fetches a list of useful information about each model. They are using different data connections so I can't do the LEFT JOIN natively.

How do I bind the data property of a PowerTable to the result dataset of A LEFT JOIN B on A.ModelNum = B.ModelNum ...

---

<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:** [October 3, 2024, 6:06pm UTC](https://forum.inductiveautomation.com/t/join-two-named-queries/19976/5 "2024-10-03T18:06:27Z")

</div>

Make some example datasets and post their CSVs here (from the dataset editor popup) in "preformatted text" code blocks. Then I can show you exactly what you need. But note, nowadays I do this exclusively in expressions using my (free) Integration Toolkit module:

> [@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…

[https://www.automation-pros.com/toolkit/doc/datasets.html#leftjoin](https://www.automation-pros.com/toolkit/doc/datasets.html#leftjoin)
