What Grafana version and what operating system are you using?
Grafana v9.1.3 / Microsoft SQL
What are you trying to achieve?
There are data of TIME, TEMP, PRESS, and NO in one table.
The NO column is the ID of the sensor.
I want to draw a time series graph of TEMP and PRESS by sensor ID.
SELECT * FROM (
SELECT
$__timeEpoch(CREATETIME),
TEMP, concat('TEMP_',NO) TMP
FROM MACHINE_ROOM_SENSOR_HIST
where $__timeFilter(CREATETIME) and NO in (1,2,3)
) StudentResults
PIVOT (
SUM(TEMP)
FOR TMP
IN (
[TEMP_1],
[TEMP_2],
[TEMP_3]
)
) AS PivotTable