# Transaction group table select with multiple rows

**URL:** <https://forum.inductiveautomation.com/t/transaction-group-table-select-with-multiple-rows/101527>\
**Category:** Ignition\
**Created:** [January 29, 2025, 1:11am UTC](https://forum.inductiveautomation.com/t/transaction-group-table-select-with-multiple-rows/101527 "2025-01-29T01:11:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Psiuyo](https://avatars.discourse-cdn.com/v4/letter/p/53a042/32.png) [@Psiuyo](https://forum.inductiveautomation.com/u/Psiuyo)\
**Post date:** [January 29, 2025, 1:11am UTC](https://forum.inductiveautomation.com/t/transaction-group-table-select-with-multiple-rows/101527/1 "2025-01-29T01:11:42Z")

</div>

Simple question, bit of a two-parter maybe. I have a transaction group, DB to OPC that selects from a table with a WHERE x=tag or y=tag clause. 99% of the time this will only return 1 row, but sometimes there may be 2 rows, how does this work when writing to the tags? Each selected row is written, last write wins? First row only? I could set my table name to a view and enforce a desired order there if need be to ensure the correct row is applied.

Second part, I also have this alternatively written as a gateway event script where I can deal with 0, 1, or 2 results, but coworkers looking at this after me are more familiar with transaction groups. Is it even worth trying to do this with a transaction group or just stick with the script?

Thank you

---

<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:** [January 29, 2025, 2:04am UTC](https://forum.inductiveautomation.com/t/transaction-group-table-select-with-multiple-rows/101527/2 "2025-01-29T02:04:37Z")

</div>

> [@Psiuyo](#):
>
> how does this work

Undefined. If you cannot use a unique index corresponding to your WHERE clause columns, use ordering and LIMIT clause in a view.

---

<div class="post-metadata">

**Author:** ![Psiuyo](https://avatars.discourse-cdn.com/v4/letter/p/53a042/32.png) [@Psiuyo](https://forum.inductiveautomation.com/u/Psiuyo)\
**Post date:** [January 29, 2025, 3:17am UTC](https://forum.inductiveautomation.com/t/transaction-group-table-select-with-multiple-rows/101527/3 "2025-01-29T03:17:08Z")

</div>

Yes I can order the results, but what happens if I end up with two rows and write that to a group of tags? Testing with a view and ordered data it appears consistently that only first row is used, and this makes complete sense and it how I would assume it operates, but I was unable to find anything that definitively said this would be the case.

---

<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:** [January 29, 2025, 1:36pm UTC](https://forum.inductiveautomation.com/t/transaction-group-table-select-with-multiple-rows/101527/4 "2025-01-29T13:36:45Z")

</div>

> [@Psiuyo](#):
>
> unable to find anything that definitively

That's what undefined means. The observed behavior is an artifact of IA's implementation details and is not assured to continue in the future. Don't rely on undefined behavior.
