Hello,
I have a problem with grouping and dividing data from different columns.
I got 4 columns one timestamp one sensortype one sensornumber and one sensorvalue. I want to select all sensorvalues and build “groups” for each different sensornumber, so that i got a number of different data sets in my graph.
I can workarround with the following SQL syntax but this is not dynamic and i want to write more efficient. I hope there is one who could help me with this problem…
Here is my present SQL syntax for just 3 different sensornumbers:
SELECT
“timestamp” AS “time”,
sensorvalue
FROM sensorvalues
WHERE
sensortype = 2 AND
sensornumber = 1
ORDER BY 1
SELECT
“timestamp” AS “time”,
sensorvalue
FROM sensorvalues
WHERE
sensortype = 2 AND
sensornumber = 2
ORDER BY 1
SELECT
“timestamp” AS “time”,
sensorvalue
FROM sensorvalues
WHERE
sensortype = 2 AND
sensornumber = 3
ORDER BY 1
In total these are three different querys and i want them merge dynamically to one query.
Thank you!
Kai