sql - select records having all null values in a specific temporal window -
i have table:
code | instant | val inside of temporal window, based on instant column value, val can null or not null. have this:
'a',2015-06-29 08:00:01,null 'a',2015-06-29 08:30:01,5 'a',2015-06-29 09:00:00,null 'b',2015-06-29 08:00:01,null 'b',2015-06-29 08:30:01,null 'b',2015-06-29 09:00:00,null now, given temporal window:
2015-06-29 08:00:00 <--> 2015-06-29 09:00:00 i'd code of records all null in temporal window. in example answer "b", records code "a" have @ least 1 entry, 5, not null specified temporal window.
if understand correctly, want codes null records within range of values. if so, can use aggregation , having clause, this:
select t.code table t t.instant >= window_start , t.instant <= window_end group t.code having max(val) null; and equivalent having clause is:
having count(val) = 0
Comments
Post a Comment