Re: Select values by interval - Mailing list pgsql-sql

From Andreas Kretschmer
Subject Re: Select values by interval
Date
Msg-id 20151123172216.GA5760@tux
Whole thread Raw
In response to Select values by interval  ("Markus Wolters" <MarkusWolters@gmx.de>)
Responses Re: Select values by interval
List pgsql-sql
Markus Wolters <MarkusWolters@gmx.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
thelast(value) timestamp combination in every X minute interval where timestamp is between N and M. Is this possible
withpgsql?
 
> 

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°



pgsql-sql by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Select values by interval
Next
From: "David G. Johnston"
Date:
Subject: Re: Select values by interval