I have a measurement data set like this:
time instanceId measurementId value
---- ---------- ------------- -----
2017-11-27T15:47:29Z instance-00 perf.int000-x 15
2017-11-27T15:47:29Z instance-01 perf.int000-x 15
2017-11-27T15:47:39Z instance-00 perf.int000-x 16
2017-11-27T15:47:39Z instance-01 perf.int000-x 16
2017-11-27T15:47:49Z instance-00 perf.int000-x 17
2017-11-27T15:47:49Z instance-01 perf.int000-x 17
2017-11-27T15:47:59Z instance-00 perf.int000-x 18
2017-11-27T15:47:59Z instance-01 perf.int000-x 18
2017-11-27T15:48:09Z instance-00 perf.int000-x 19
2017-11-27T15:48:09Z instance-01 perf.int000-x 19
2017-11-27T15:48:19Z instance-00 perf.int000-x 20
2017-11-27T15:48:29Z instance-00 perf.int000-x 21
2017-11-27T15:48:39Z instance-00 perf.int000-x 22
2017-11-27T15:48:49Z instance-00 perf.int000-x 23
2017-11-27T15:50:59Z instance-00 perf.int000-x 36
2017-11-27T15:51:09Z instance-00 perf.int000-x 37
2017-11-27T15:51:19Z instance-00 perf.int000-x 38
2017-11-27T15:51:29Z instance-00 perf.int000-x 39
2017-11-27T15:51:39Z instance-00 perf.int000-x 40
2017-11-27T15:51:49Z instance-01 perf.int000-x 41
2017-11-27T15:51:49Z instance-00 perf.int000-x 41
2017-11-27T15:51:59Z instance-01 perf.int000-x 42
2017-11-27T15:51:59Z instance-00 perf.int000-x 42
2017-11-27T15:52:09Z instance-01 perf.int000-x 43
and I would like to create SUM only for those values where both instances, instance-00 and instance-01 are defined
and for those values where only one instance or null is defined there shall be null in result.
Is there any way how to put condition for null value to WHERE part of query?
e.g. SELECT sum(“value”) as sum FROM “measures” WHERE (“measurementId” = ‘perf.int000-x’ AND “value” != null) GROUP BY time(10s)