You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SELECTtimestamp/1000as time_sec,
data.valueas value,
properties.valueas metric
FROM data
LEFT JOIN properties ON (properties.entity_id=data.channel_id)
LEFT JOIN entities ON (entities.id=data.channel_id)
WHERE
(channel_id =1|| channel_id =2|| channel_id =3) ANDtimestamp>= $__unixEpochFrom()*1000ANDtimestamp<= $__unixEpochTo()*1000ANDproperties.pkey='title'ORDER BYtimestampASC
Using channel names
SELECTtimestamp/1000as time_sec,
data.valueas value,
properties.valueas metric
FROM data
LEFT JOIN properties ON (properties.entity_id=data.channel_id)
LEFT JOIN entities ON (entities.id=data.channel_id)
WHERE
(properties.value="Flur"||properties.value="Werkstatt" ) ANDtimestamp>= $__unixEpochFrom()*1000ANDtimestamp<= $__unixEpochTo()*1000ANDproperties.pkey='title'ORDER BYtimestampASC
Using UUID
SELECTtimestamp/1000as time_sec,
data.valueas value,
properties.valueas metric
FROM data
LEFT JOIN properties ON (properties.entity_id=data.channel_id)
LEFT JOIN entities ON (entities.id=data.channel_id)
WHERE
(uuid ="12345678-1234-1234-1234-1234567890ab"|| uuid ="12345678-1234-1234-1234-1234567890ac" ) ANDtimestamp>= $__unixEpochFrom()*1000ANDtimestamp<= $__unixEpochTo()*1000ANDproperties.pkey='title'ORDER BYtimestampASC
you can significant improve the access by changing the WHERE clause:
SELECT
timestamp/1000 as time_sec,
data.value as StundenProTag,
properties.value as metric
FROM data
LEFT JOIN properties ON (properties.entity_id = data.channel_id)
LEFT JOIN entities ON (entities.id = data.channel_id)
WHERE
(uuid = "02363c80-4789-11ea-845f-7d8b8b898c67") AND
timestamp >= 1000 * $__unixEpochFrom() AND
timestamp <= 1000 * $__unixEpochTo() AND
properties.pkey = 'title'
ORDER BY timestamp ASC
just in case somebody finds that like me...
you can significant improve the access by changing the WHERE clause: