[SQL] window function to sort times series data?

2010-03-24 Thread Louis-David Mitterrand
Hi, I have time series data: price(id_price int, price int, created_on timestamp) I'd like to select the latest price before, say, 2010-03-10 and the latest price after that date. Using group by and self-joins I was able to build a (quite large :) working query. But I wonder if there is a

Re: [SQL] window function to sort times series data?

2010-03-24 Thread A. Kretschmer
In response to Louis-David Mitterrand : Hi, I have time series data: price(id_price int, price int, created_on timestamp) I'd like to select the latest price before, say, 2010-03-10 and the latest price after that date. test=*# select * from price ; id_price | price | created_on

Re: [SQL] window function to sort times series data?

2010-03-24 Thread Louis-David Mitterrand
On Wed, Mar 24, 2010 at 03:29:36PM +0100, A. Kretschmer wrote: In response to Louis-David Mitterrand : Hi, I have time series data: price(id_price int, price int, created_on timestamp) I'd like to select the latest price before, say, 2010-03-10 and the latest price after that

Re: [SQL] window function to sort times series data?

2010-03-24 Thread A. Kretschmer
In response to Louis-David Mitterrand : On Wed, Mar 24, 2010 at 03:29:36PM +0100, A. Kretschmer wrote: In response to Louis-David Mitterrand : Hi, I have time series data: price(id_price int, price int, created_on timestamp) I'd like to select the latest price before, say,

Re: [SQL] window function to sort times series data?

2010-03-24 Thread Andreas Kretschmer
A. Kretschmer andreas.kretsch...@schollglas.com wrote: Well, and now i'm using 8.4 windowing-functions: test=*# select * from price order by price_id, d; price_id | price | d --+---+ 1 |10 | 2010-03-12 1 |11 | 2010-03-19 1 |12 |

Re: [SQL] window function to sort times series data?

2010-03-24 Thread Louis-David Mitterrand
On Wed, Mar 24, 2010 at 05:29:46PM +0100, Andreas Kretschmer wrote: A. Kretschmer andreas.kretsch...@schollglas.com wrote: Well, and now i'm using 8.4 windowing-functions: test=*# select * from price order by price_id, d; price_id | price | d --+---+

Re: [SQL] window function to sort times series data?

2010-03-24 Thread John Gage
In going through the arcana of string functions, I have come across the following series of selects that contain, for me, a mysterious $re$. -- return all matches from regexp SELECT regexp_matches('foobarbequebaz', $re$(bar)(beque)$re$); -- test case insensitive SELECT

Re: [SQL] window function to sort times series data?

2010-03-24 Thread Josh Kupershmidt
On Wed, Mar 24, 2010 at 2:38 PM, John Gage jsmg...@gmail.com wrote: In going through the arcana of string functions, I have come across the following series of selects that contain, for me, a mysterious $re$. -- return all matches from regexp SELECT regexp_matches('foobarbequebaz',