Re: Solution to retrieve first and last row for each minute - Mailing list pgsql-sql

From Christian Kindler
Subject Re: Solution to retrieve first and last row for each minute
Date
Msg-id 20070822133517.107820@gmx.net
Whole thread Raw
In response to Solution to retrieve first and last row for each minute  (roopa perumalraja <roopabenzer@yahoo.com>)
List pgsql-sql
Its really slow but what you can do is something like the following:

select count(a.*), b.* from foo.bar a,
(
select price from foo.bar order by time asc limit 1
union 
select price from foo.bar order by time desc limit 1
) as b
group by b.price
... just do the "wheres" as you need  ...

Chris

PS its untested maybe there are some syntax miss-spells



-- 
cu
Chris

Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser


pgsql-sql by date:

Previous
From: "Aleksandr Vinokurov"
Date:
Subject: Partial index and query plan
Next
From: Tom Lane
Date:
Subject: Re: Partial index and query plan