阅读背景:

如果缺少的话,PostgreSQL将使用前一行的值

来源:互联网 

I have a following query:

我有以下问题:

WITH t as (
  SELECT date_trunc('hour', time_series) as trunc 
  FROM generate_series('2013-02-27 22:00'::timestamp, '2013-02-28 2:00', 
                       '1 hour') as time_series
  GROUP BY trunc
  ORDER BY trunc
)
SELECT DISTINCT ON(trunc) trunc, id
FROM t
LEFT JOIN (
   SELECT id, created, date_trunc('hour', created) as trunc_u
   FROM event
   ORDER BY created DESC
) u
ON trunc = trunc_u
WITH t as



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: