# Conditionally Appending Columns using Data from Table

**URL:** <https://forum.inductiveautomation.com/t/conditionally-appending-columns-using-data-from-table/70841>\
**Category:** Ignition\
**Tags:** ignition81, scripting, perspective\
**Created:** [March 9, 2023, 3:49pm UTC](https://forum.inductiveautomation.com/t/conditionally-appending-columns-using-data-from-table/70841 "2023-03-09T15:49:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CMuecke](https://avatars.discourse-cdn.com/v4/letter/c/df705f/32.png) [@CMuecke](https://forum.inductiveautomation.com/u/CMuecke)\
**Post date:** [March 9, 2023, 3:49pm UTC](https://forum.inductiveautomation.com/t/conditionally-appending-columns-using-data-from-table/70841/1 "2023-03-09T15:49:24Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/b/5b324f5084c23975a9d54f0b67e11d95f39e316d.png)

I have a query that grabs information from the database. On the right of the picture, you can see a two of the rows from the Database. For future data manipulation, I would like to use a transform script to append Columns called Source 1/Source 2 if they find Sources that have the same Ingredient Code.

Is there a way to do this?

---

<div class="post-metadata">

**Author:** ![Dalton\_Adams](https://avatars.discourse-cdn.com/v4/letter/d/7c8e57/32.png) [@Dalton\_Adams](https://forum.inductiveautomation.com/u/Dalton_Adams)\
**Post date:** [March 9, 2023, 4:20pm UTC](https://forum.inductiveautomation.com/t/conditionally-appending-columns-using-data-from-table/70841/2 "2023-03-09T16:20:50Z")

</div>

You could use a crosstab query. Or you could make a new table and append the values you want to the new table selected from each source based off your desired criteria.

---

<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:** [March 11, 2023, 11:11am UTC](https://forum.inductiveautomation.com/t/conditionally-appending-columns-using-data-from-table/70841/3 "2023-03-11T11:11:37Z")

</div>

That would normally be done in the DB using a JOIN to a table that describes the sources.
