pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christian Kindler <christian.kindler@gmx.net>
To: roopa perumalraja <roopabenzer@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Solution to retrieve first and last row for each minute
Date: Wed, 22 Aug 2007 15:35:17 +0200
Message-ID: <20070822133517.107820@gmx.net> (raw)

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



view thread (4+ messages)

Message-ID: <20070822133517.107820@gmx.net>
Permalink:  ../20070822133517.107820@gmx.net/
Also on:    postgresql.org/message-id/20070822133517.107820@gmx.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: christian.kindler@gmx.net, roopabenzer@yahoo.com
  Subject: Re: Solution to retrieve first and last row for each minute
  In-Reply-To: <20070822133517.107820@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox