I have a query variable that returns a single row of values from a PostgreSQL database. Is it possible to extract the first or second value from this variable directly for use in further query?
Example:
Consider the following query:
SQL
SELECT name FROM users;
This would return
John
Wick
Jack
Reacher
This query returns a single row : name. I’d like to access the name value directly, if possible.
Specifically, I’m wondering if I can use syntax like ${Query.[0]} to achieve this, as opposed to adding the names as a filter on a dashboard.
So in the visualization, i could query
SELECT last_login
FROM logintable
WHERE user = ${Query.[0]}
And it would give me all of John’s login and ${Query.[1]} would give all of Wick’s login so on and so forth.
I’m open to using alternative approaches if direct indexing isn’t feasible.
Thank you for any insights or suggestions!