# Tag SQL Query

**URL:** <https://forum.inductiveautomation.com/t/tag-sql-query/3706>\
**Category:** Ignition\
**Created:** [December 7, 2011, 12:37am UTC](https://forum.inductiveautomation.com/t/tag-sql-query/3706 "2011-12-07T00:37:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joseph\_Mendonca](https://avatars.discourse-cdn.com/v4/letter/j/58f4c7/32.png) [@Joseph\_Mendonca](https://forum.inductiveautomation.com/u/Joseph_Mendonca)\
**Post date:** [December 7, 2011, 12:37am UTC](https://forum.inductiveautomation.com/t/tag-sql-query/3706/1 "2011-12-07T00:37:18Z")

</div>

Tried to query the DB calvalue using the tag path site35/number but was unsuccessful. When using siteid=35 it works ok. Is it possible to use the path?

```auto
select top 1 calvalue from flowcalibration where siteid ={[~]site35/number} order by t_stamp desc 
```

---

<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:** [December 7, 2011, 12:44am UTC](https://forum.inductiveautomation.com/t/tag-sql-query/3706/2 "2011-12-07T00:44:14Z")

</div>

Yes, you should be able to use another tag’s value in the SQL query. I think the path should be a little bit different with no ~. Did you use the tag link button to the right of the query? Is the DB query tag in the same folder as the number tag?

---

<div class="post-metadata">

**Author:** ![Joseph\_Mendonca](https://avatars.discourse-cdn.com/v4/letter/j/58f4c7/32.png) [@Joseph\_Mendonca](https://forum.inductiveautomation.com/u/Joseph_Mendonca)\
**Post date:** [December 7, 2011, 12:55am UTC](https://forum.inductiveautomation.com/t/tag-sql-query/3706/3 "2011-12-07T00:55:58Z")

</div>

Did you use the tag link button to the right of the query? Yes

Is the DB query tag in the same folder as the number tag? Same parent folder but different subfolder

---

<div class="post-metadata">

**Author:** ![Joseph\_Mendonca](https://avatars.discourse-cdn.com/v4/letter/j/58f4c7/32.png) [@Joseph\_Mendonca](https://forum.inductiveautomation.com/u/Joseph_Mendonca)\
**Post date:** [December 7, 2011, 1:01am UTC](https://forum.inductiveautomation.com/t/tag-sql-query/3706/4 "2011-12-07T01:01:08Z")

</div>

Ok, my bad…wrong data type. Fixed now it works
