Commit c870cc85 authored by David Schäfer's avatar David Schäfer
Browse files

query cleanups

parent 31fe1f35
......@@ -19,13 +19,9 @@ SELECT
JOIN LOGGER.LOGGER l on l.logger_id = c.logger_id
JOIN DATENMANAGEMENTPORTAL.ORT o on o.ort_id = s.ort_id
WHERE l.datenprojekt_id = :1
-- AND l.deleted = 0
-- AND s.deleted = 0
-- AND s.updated = 0
AND s.virtual_sensor = 0
AND s.evaluate_sensor = 1
-- AND c.deleted = 0
-- AND c.config_end IS NULL
AND s.evaluate_sensor = 1 -- exclude the timestamp only sensors
AND c.deleted = 0
%s
ORDER BY s.sensor_id
OFFSET :2 ROWS FETCH NEXT :3 ROWS ONLY
......@@ -2,21 +2,17 @@
SELECT
TO_CHAR(r.timestamp_measurement, 'YYYY-MM-DD HH24:MI:SS') AS timestamp_measurement
, s.sensor_id
, s.name AS sensor_name
, s.label AS sensor_label
, v.level1_value_id AS value_id
FROM LOGGER.LOGGER l
JOIN LOGGER.LEVEL1_RECORD r ON l.LOGGER_ID = r.LOGGER_ID
JOIN LOGGER.LEVEL1_VALUE v ON r.LEVEL1_RECORD_ID = v.LEVEL1_RECORD_ID
JOIN LOGGER.SENSOR s ON v.SENSOR_ID = s.SENSOR_ID
-- JOIN LOGGER.SENSOR_CONFIGURATION c on c.SENSOR_CONFIGURATION_ID = s.SENSOR_CONFIGURATION_ID
WHERE l.datenprojekt_id = :1
AND l.logger_id = :2
AND timestamp_measurement >= LOGGER.DMP_DATE.PARSE(:3)
AND timestamp_measurement <= LOGGER.DMP_DATE.PARSE(:4)
-- AND l.deleted = 0
-- AND s.deleted = 0
-- AND s.updated = 0
AND s.virtual_sensor = 0
AND s.evaluate_sensor = 1
-- AND c.deleted = 0
-- AND c.config_end IS NULL
ORDER BY s.sensor_id, r.timestamp_measurement
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment