[lug] postgresql query question

D. Stimits stimits at comcast.net
Mon May 15 18:29:23 MDT 2006


Nick Golder wrote:
> Is there a way to query data between two timestamps based on some
> selected interval?  For example, I want to query all data for every 60
> second interval between 2004-09-10 14:00:00 and 2004-10-10 14:00:00.
> I looked at 'INTERVAL' but that appears to only show it for the first
> interval after a selected timestamp.  

I wouldn't normally suggest something like PL/pgSQL, but it might let 
you create your own function without too much effort. Check out 
"createlang" for adding PL/pgSQL to your database (unless template1 had 
this installed, in which case your db inherited it). You could build it 
around an ordinary loop.

D. Stimits, stimits AT comcast DOT net




More information about the LUG mailing list