GetLastValid 函数抽取时间系列中给定时间戳记的元素。
GetLastValid(ts TimeSeries, tstamp datetime year to fraction(5), flags integer default 0) returns row;
对于规则的时间系列,此函数返回在给定时间戳记或之前的日历最新有效时间点的元素。对于不规则的时间系列,将返回给定时间戳记或之前的最新元素。
等效的 API 函数为 ts_last_valid()。
包含在给定时间戳记或之前的最近元素的行类型。该行的类型与时间系列子类型相同。
如果时间戳记早于时间系列的原点,那么将返回 NULL。
select GetLastValid(stock_data, '2011-01-08 00:00:00.00000') from daily_stocks where stock_name = 'GBase';