From: | Andreas Kretschmer <akretschmer(at)spamfence(dot)net> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Select values by interval |
Date: | 2015-11-23 17:22:16 |
Message-ID: | 20151123172216.GA5760@tux |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Markus Wolters <MarkusWolters(at)gmx(dot)de> wrote:
> Hi all,
>
> I have a table with value and timestamp columns. What I like to do (but am unable to find a solution) is to select the last(value) timestamp combination in every X minute interval where timestamp is between N and M. Is this possible with pgsql?
>
maybe somethink like
select *, row_number() over (partition by to_char(timestamp, 'yyyy-mm-dd
hh24:mm') order by ... desc) ...
and then pick all with row_number = 1
*untested*
Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknown)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2015-11-23 17:25:05 | Re: Select values by interval |
Previous Message | David G. Johnston | 2015-11-23 16:49:06 | Re: Select values by interval |