5 Replies Latest reply on Dec 13, 2018 8:24 AM by xando

    Average SQL query




      I running this query and I like to collect average values between this two dates but this signals don't
      have values inside that range, it returns values that's over 1 year before the start date, it should then
      return 0 or null. What am I'm doing wrong?


      SELECT tag, CAST(value AS Float32) value, time
      FROM piarchive..piavg
      WHERE time BETWEEN DATE('2018-11-26 06:00:00') AND DATE('2018-12-03 06:00:00')
      AND tag IN ('PEX163_SAMPLES_01_CONS',