Unix Technical Forum

Re: Solution to retrieve first and last row for each minute

This is a discussion on Re: Solution to retrieve first and last row for each minute within the pgsql Sql forums, part of the PostgreSQL category; --> Its really slow but what you can do is something like the following: select count(a.*), b.* from foo.bar a, ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Sql

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 05:49 PM
Christian Kindler
 
Posts: n/a
Default Re: Solution to retrieve first and last row for each minute

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

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:34 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com