# Query tag referencing separate tags

**URL:** <https://forum.inductiveautomation.com/t/query-tag-referencing-separate-tags/54261>\
**Category:** Ignition\
**Created:** [December 17, 2021, 7:31pm UTC](https://forum.inductiveautomation.com/t/query-tag-referencing-separate-tags/54261 "2021-12-17T19:31:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xtristan](https://avatars.discourse-cdn.com/v4/letter/x/ba8739/32.png) [@xtristan](https://forum.inductiveautomation.com/u/xtristan)\
**Post date:** [December 17, 2021, 7:31pm UTC](https://forum.inductiveautomation.com/t/query-tag-referencing-separate-tags/54261/1 "2021-12-17T19:31:51Z")

</div>

I have a string containing the date and time in a format that is able to be compared to the Unix time of t\_stamp for Historian tags. I want to use the same query tag to run the same query every couple hours with only the t\_stamp being referenced changing. I’m having an issue running a query while referencing an Ignition tag with {[.]Tag Name} even though {[.]Tag Name} is grabbed from the tag icon available in the expression editor.

Is a query tag able to reference an Ignition tag, and if not, what would be the best way to run a dynamic query and store that value in a tag?

---

<div class="post-metadata">

**Author:** ![Brad\_Medley](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@Brad\_Medley](https://forum.inductiveautomation.com/u/Brad_Medley)\
**Post date:** [July 6, 2022, 7:15pm UTC](https://forum.inductiveautomation.com/t/query-tag-referencing-separate-tags/54261/2 "2022-07-06T19:15:39Z")

</div>

Did you find a solution to this?

---

<div class="post-metadata">

**Author:** ![rbanaszak](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/rbanaszak/32/6929_2.png) [@rbanaszak](https://forum.inductiveautomation.com/u/rbanaszak)\
**Post date:** [December 7, 2022, 8:27pm UTC](https://forum.inductiveautomation.com/t/query-tag-referencing-separate-tags/54261/3 "2022-12-07T20:27:09Z")

</div>

This is possible, one thing that is easily missed is that if your query doesnt return a result set, you will get the "Error\_ExpressionEval". So make sure that the query that is running is indeed returning good data.

---

<div class="post-metadata">

**Author:** ![Travis.Dreier](https://avatars.discourse-cdn.com/v4/letter/t/e9bcb4/32.png) [@Travis.Dreier](https://forum.inductiveautomation.com/u/Travis.Dreier)\
**Post date:** [February 25, 2026, 3:44pm UTC](https://forum.inductiveautomation.com/t/query-tag-referencing-separate-tags/54261/4 "2026-02-25T15:44:29Z")

</div>

When working with string variables in Query tags the variable works even when in quotes.

SELECT \*  
FROM MyTable  
WHERE intColumn = {[.]IntegerTag} and nvarcharColumn = '{[.]StringTag}'
