# String tag in query

**URL:** <https://forum.inductiveautomation.com/t/string-tag-in-query/21362>\
**Category:** Ignition\
**Created:** [December 12, 2018, 7:20am UTC](https://forum.inductiveautomation.com/t/string-tag-in-query/21362 "2018-12-12T07:20:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Claus\_Nielsen](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@Claus\_Nielsen](https://forum.inductiveautomation.com/u/Claus_Nielsen)\
**Post date:** [December 12, 2018, 7:20am UTC](https://forum.inductiveautomation.com/t/string-tag-in-query/21362/1 "2018-12-12T07:20:07Z")

</div>

Hello all,

Trying to run a query where I need to use another tags value in the query, see query below

```auto
SELECT
	...
FROM user u
	...
WHERE u.id >= 10
GROUP BY u.id
ORDER BY u.username = {[System]Client/User/Username} DESC

```

The query runs in a Query Tag

The problem is in the ORDER BY clause where using the tag doesn’t seem to have any effect in the query, however writing a valid username in it’s place makes that user always appear first.

Any ideas why I can’t use the tag value? Tried wrapping the tag in quotes with the same effect.

---

<div class="post-metadata">

**Author:** ![Claus\_Nielsen](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@Claus\_Nielsen](https://forum.inductiveautomation.com/u/Claus_Nielsen)\
**Post date:** [December 12, 2018, 8:02am UTC](https://forum.inductiveautomation.com/t/string-tag-in-query/21362/2 "2018-12-12T08:02:23Z")

</div>

Nevermind, fixed it using a query without the ordering and another expression tag using @pturmel Simulation Aids ‘view’ expression function.
