Access Variable's Multiple Values

  • What Grafana version and what operating system are you using?
    8.0.3

  • What are you trying to achieve?
    A single selection variable dropdown that I can access different values for.

  • How are you trying to achieve it?
    In the my_var variable setup: select id as __value, name as __text, bar_id from my_table

In the panel query: SELECT * FROM foo WHERE id = $my_var AND bar = $my_var$bar_id

  • What happened?
    $my_var works for returning the __value but I cannot figure out how to access the other columns of the variable.

Is what I am doing possible? I am using postgresql, but struggling with how I can use the variables, so any general pointers is helpful as well!