# MySQL Function call within Query Tag

**URL:** <https://forum.inductiveautomation.com/t/mysql-function-call-within-query-tag/5750>\
**Category:** Ignition\
**Created:** [January 28, 2013, 6:26pm UTC](https://forum.inductiveautomation.com/t/mysql-function-call-within-query-tag/5750 "2013-01-28T18:26:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RRNut](https://avatars.discourse-cdn.com/v4/letter/r/8e7dd6/32.png) [@RRNut](https://forum.inductiveautomation.com/u/RRNut)\
**Post date:** [January 28, 2013, 6:26pm UTC](https://forum.inductiveautomation.com/t/mysql-function-call-within-query-tag/5750/1 "2013-01-28T18:26:14Z")

</div>

I’d like to call a MySQL Function within the select statement of a Query Tag. The function returns a single value.

The syntax below doesn’t work:  
select f2HrAvg({[.]PrevPrd/DayYear},‘10’);  
The value in the brackets is a ind. auto tag.

It does work if I hard code the values as shown below:  
select f2HrAvg(‘2012005’,‘10’);

Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [January 28, 2013, 6:49pm UTC](https://forum.inductiveautomation.com/t/mysql-function-call-within-query-tag/5750/2 "2013-01-28T18:49:51Z")

</div>

The only thing I can see is you use quotes in your hard-coded example. Maybe do the same thing with your dynamic one:`select f2HrAvg('{[.]PrevPrd/DayYear}','10')`You can right click on the tag and select “Tag Diagnostics” to see the error message.
