# Transaction Groups - SQL Select -\> OPC

**URL:** <https://forum.inductiveautomation.com/t/transaction-groups-sql-select-opc/12148>\
**Category:** General Discussion\
**Created:** [September 21, 2016, 9:00pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-sql-select-opc/12148 "2016-09-21T21:00:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steve](https://avatars.discourse-cdn.com/v4/letter/s/f19dbf/32.png) [@Steve](https://forum.inductiveautomation.com/u/Steve)\
**Post date:** [September 21, 2016, 9:00pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-sql-select-opc/12148/1 "2016-09-21T21:00:01Z")

</div>

Can anyone provide guidance to or provide a good example of how to use SQL Select statements in Transaction Groups to pull data from SQL tables and write the results to OPC PLC tags?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [September 22, 2016, 10:11am UTC](https://forum.inductiveautomation.com/t/transaction-groups-sql-select-opc/12148/2 "2016-09-22T10:11:49Z")

</div>

Hi Steve, welcome to the forums! 🙂

An initial example. The read expression items is are queries, the scale expression items massage the query result and send to a tag as a target instead of a database column.

This could be made more efficient by having one query (assuming everything you want is in one table) and using lookup expressions to extract items from the dataset.

Hope this helps!

[attachment=2]2016-09-22\_6-02-10.jpg[/attachment]

---

<div class="post-metadata">

**Author:** ![Steve](https://avatars.discourse-cdn.com/v4/letter/s/f19dbf/32.png) [@Steve](https://forum.inductiveautomation.com/u/Steve)\
**Post date:** [September 22, 2016, 1:32pm UTC](https://forum.inductiveautomation.com/t/transaction-groups-sql-select-opc/12148/3 "2016-09-22T13:32:49Z")

</div>

Thanks for the example Jordan. I’m sure it will help.
