String tag in query

Hello all,

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

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.

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

2 Likes