InfluxDB Variable Query Regarding Another

Hi everyone,

It’s possible to see which measurement contains the selected value?
I have one variable like:

$number - SELECT “Number” FROM (SELECT “”, “Number” FROM “1”, “2”, “3”, “4”, “5”)

And in the next variable i would like to show only the measurements where the value of the query above is found.
I tried something like this but don’t work:

$ID - SHOW MEASUREMENTS WHERE “Number” =~ $number

Anyone can help me with this?

can you show us data format and structure ?
maybe Explore your schema using InfluxQL | InfluxDB OSS 1.8 Documentation
SHOW SERIES ON [DATABASE] FROM (SELECT “”, “Number” FROM “1”, “2”, “3”, “4”, “5”)
I strongly recommand you to use flux (influxdb 2.0+) since you have all structure in data you can filter to get the same result.

1 Like

Data format and structure is this?

nope i mean a sample of result from your query, i can’t imagine what is in your database.

your issue is weird since you need to get table name from data coming from this table.
I think you should consider change structure of your data in the base, maybe add a field with your needed information.
Why did you split data in multiple measurement ?

I have something like this in database:

So the main purpose will be when i select some number (This number is available in variable “$number”) the next variable “$id” should only shows the ID where this number exist.
For example:

  • if i choose “e422” in ID only will show “2”
  • if i choose “c223” in ID will show “1” and “3”

this struct have no sense… but it’s wrong too, 1,2,3 are table name not column name, number are your column… not your row something
why not have

id, number_value
e422, 2
c223, 1
c223 ,2

What do you use to insert this in your base ? Telegraf ? Node-red ?