# SQL tag with reference to other tag

**URL:** <https://forum.inductiveautomation.com/t/sql-tag-with-reference-to-other-tag/19226>\
**Category:** Ignition\
**Created:** [August 13, 2018, 3:41pm UTC](https://forum.inductiveautomation.com/t/sql-tag-with-reference-to-other-tag/19226 "2018-08-13T15:41:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bdecelles](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bdecelles/32/5713_2.png) [@bdecelles](https://forum.inductiveautomation.com/u/bdecelles)\
**Post date:** [August 13, 2018, 3:41pm UTC](https://forum.inductiveautomation.com/t/sql-tag-with-reference-to-other-tag/19226/1 "2018-08-13T15:41:53Z")

</div>

I am trying to have a query tag that references another tag for my query, and it keeps coming back as null.

```auto
SELECT fname FROM auth_users WHERE username = '{[System]Client/User/Username}'

```

If I replace the {[System]Client/User/Username} with a static u1234 (a user in the db), it returns the proper name. I can’t figure out what I’m doing wrong here…

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 13, 2018, 3:45pm UTC](https://forum.inductiveautomation.com/t/sql-tag-with-reference-to-other-tag/19226/2 "2018-08-13T15:45:58Z")

</div>

Query tags run in the gateway scope - so they don’t have access to the [System] **Client** tags.  
If you only need access to this information within a vision client, then you can use a [client tag](https://docs.inductiveautomation.com/display/DOC79/Types+of+Tags#TypesofTags-ClientTags) to query for the `fname` value.

---

<div class="post-metadata">

**Author:** ![bdecelles](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bdecelles/32/5713_2.png) [@bdecelles](https://forum.inductiveautomation.com/u/bdecelles)\
**Post date:** [August 13, 2018, 3:46pm UTC](https://forum.inductiveautomation.com/t/sql-tag-with-reference-to-other-tag/19226/3 "2018-08-13T15:46:51Z")

</div>

Of course. Overlooked that fact. Thanks!
