2 (or more) sensors in the same graph

HI! I am very very new in influxdb and IOT.
I am getting data from 2 sensors (in the future will be more) and i am storing the data in 2 MEASUREMENTS, “temp” and “hum”.
In this measurements i have set 3 “columns” (sorry for the terminology i don’t quite understand influx 100%), timetag(automatically via influx), value and sensor_id.
I want to put all the sensors in the same graphic and i want to be dynamic, if i add a new sensor i want that the data appears automatically in the graph.

Like i said i am very new in influx and i have no problem in remaking the database if necessary.
I put some images to help explain.


In this image i have the 2 querys for both MEASUREMENTS in the same graph but i can chage that if is a problem. As you can see both sensors sand data at the same time (coincidence). I want to be group by the sensor_id.

influx
Here are the data stored.

Thanks in advance! Happy new year!

so you have multiple tables with different datasets.
you have to add a where clause to filter for the disp_id.

Can you give me an example? I want to be dynamic if in the future i add more “disp_id” (for example the id 3 or 4) i want that all of them appear in the plot.

Thanks

yes
where disp_id=“1”

@melrose thank you.
I tried what you say but it dosent do what i am looking for.
Perhaps i am not expressing my self right.

Here is the scenario (in this days redo all the structure of the db). I have a DB whit a measurement “medicion” (it translate as measurement) every entry in that “table” has the next fields.
mediciones
As you can see i have a column that is device number (nDisp) and other 3 columns that are diferent values from the device.

The problem.
I want to show in a single graph all the temperatures from the different sensors like
this

Today i am making this whit 2 querys like this

I want to know if i can do this but whit only one query and if tomorrow i add a new sensor, the data of that sensor is showed in the graph without modifying the query.

Thank you.

ok i wait until tomorrow when you add a new sensor

@melrose Thank you for your extensive, detailed and very very help full posts.

I solved the problem.
The problem was that i was using fields instead of tags for the nDisp number.
When you use that grafana (or maybe influx i dont know) didnt separate well using GROUP BY in the query.
Once i rewrote all the NodeRed flow and drop the database, the nDisp its now a tag that can be indexable using GROUP BY and can be separated by grafana, when i add a new device in the set it automatically adds the data to the graph.

I hope this will be useful for someone else.

just what i wrote, thank you for the confirmation