# Combine two Named Queries in one Table

**URL:** <https://forum.inductiveautomation.com/t/combine-two-named-queries-in-one-table/90159>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [May 9, 2024, 2:22pm UTC](https://forum.inductiveautomation.com/t/combine-two-named-queries-in-one-table/90159 "2024-05-09T14:22:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [May 9, 2024, 2:22pm UTC](https://forum.inductiveautomation.com/t/combine-two-named-queries-in-one-table/90159/1 "2024-05-09T14:22:58Z")

</div>

Hello all!

I do have 2 named queryes with the same column "Name" how I can combine both in one table with perspective tables?

---

<div class="post-metadata">

**Author:** ![Ryan\_Ahlstrom](https://avatars.discourse-cdn.com/v4/letter/r/ecb155/32.png) [@Ryan\_Ahlstrom](https://forum.inductiveautomation.com/u/Ryan_Ahlstrom)\
**Post date:** [May 9, 2024, 2:49pm UTC](https://forum.inductiveautomation.com/t/combine-two-named-queries-in-one-table/90159/2 "2024-05-09T14:49:15Z")

</div>

Hi Alejandro,

I would start by taking the results of your named queries and putting them as custom properties on the component you are using. Then you can do some scripting to take these two properties in dataset form and combine them. Create an empty list and loop through each of the datasets appending to the empty list.

Once you have all the data in the new list then convert it to a new dataset and assign that to the table data.  
The docs I linked are a good start and you should be able to extrapolate from their script example.

> **[Datasets | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/platform/scripting/python-scripting/variables-datatypes-and-objects/datasets)**
>
> Datasets and PyDatasets

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [May 9, 2024, 2:51pm UTC](https://forum.inductiveautomation.com/t/combine-two-named-queries-in-one-table/90159/3 "2024-05-09T14:51:24Z")

</div>

Thanks Ryan for your explanation. Will look for a solution with your guidelines.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 9, 2024, 2:57pm UTC](https://forum.inductiveautomation.com/t/combine-two-named-queries-in-one-table/90159/4 "2024-05-09T14:57:34Z")

</div>

> [@Alejandro\_Alaco](#):
>
> I do have 2 named queryes

Why not have only one query with a UNION, if required?

> **[SQL UNION Operator](https://www.w3schools.com/sql/sql_union.asp)**
>
> W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [May 9, 2024, 3:00pm UTC](https://forum.inductiveautomation.com/t/combine-two-named-queries-in-one-table/90159/5 "2024-05-09T15:00:23Z")

</div>

Ok, thanks Transistor, that would be more straightforward, just working refactoring an older project with a lot of quick fixes.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 9, 2024, 3:02pm UTC](https://forum.inductiveautomation.com/t/combine-two-named-queries-in-one-table/90159/6 "2024-05-09T15:02:41Z")

</div>

Make sure that both queries return the same number of columns and that they're the same datatypes in the corresponding columns.
