Re: [SQL] Given 02-01-2006 to 02-28-2006, output all days.

2006-02-20 Thread Mark R. Dingee
Pedro, Would something such as this suffice? Mark create function get_date_range(date, date) returns setof date as ' DECLARE     cur date; BEGIN     cur := $1;     while cur <= $2 LOOP          return next cur;          cur := cur + interval ''1 day'';     end LOOP;     return; END;' language

Re: [SQL] Given 02-01-2006 to 02-28-2006, output all days.

2006-02-20 Thread Pedro B.
Hello. I'm having difficulties on my first incursion through generate_series. The details: SELECT DATE_TRUNC('month', timestamp '2006-02-01' )::DATE + s.d AS date,       COUNT (o."04-sms") as totalcause98       FROM generate_series(11,19) AS s(d)  LEFT JOIN netopia o ON (substr(o."26-insertTime",

Re: [SQL] Given 02-01-2006 to 02-28-2006, output all days.

2006-02-19 Thread Michael Fuhr
On Sun, Feb 19, 2006 at 01:47:21PM -0500, Henry Ortega wrote: > I was able to find a suitable 7.3.2 plpgsql.so and now plpgsql works. > (supposedly) > > I am trying out some really basic function creation such as this: > > create function dng2(start_date DATE) returns setof date as $$ > declare >

Re: [SQL] Given 02-01-2006 to 02-28-2006, output all days.

2006-02-19 Thread Stephan Szabo
On Sun, 19 Feb 2006, Henry Ortega wrote: > I was able to find a suitable 7.3.2 plpgsql.so and now plpgsql works. > (supposedly) > > I am trying out some really basic function creation such as this: > > create function dng2(start_date DATE) returns setof date as $$ > declare > aa date:=start_date;

Re: [SQL] Given 02-01-2006 to 02-28-2006, output all days.

2006-02-19 Thread Henry Ortega
ectively obsolete (37 releases old); there are a number of bugfixes and performance improvements in more recent versions.-Owen-Original Message- From: Henry Ortega [mailto:[EMAIL PROTECTED]]Sent: Friday, February 17, 2006 2:06 PMTo: Owen JacobsonSubject: Re: [SQL] Given 02-01-2006 to 02-28-

Re: [SQL] Given 02-01-2006 to 02-28-2006, output all days.

2006-02-17 Thread Owen Jacobson
-Owen -Original Message- From: Henry Ortega [mailto:[EMAIL PROTECTED] Sent: Friday, February 17, 2006 2:06 PM To: Owen Jacobson Subject: Re: [SQL] Given 02-01-2006 to 02-28-2006, output all days. This sounds good. I don't have plpgsql loaded though. I am trying to load plpgsql and it's g

Re: [SQL] Given 02-01-2006 to 02-28-2006, output all days.

2006-02-17 Thread Michael Fuhr
On Fri, Feb 17, 2006 at 04:07:28PM -0500, Henry Ortega wrote: > Is there a real quick way to do a query that will show me all the dates > given a startdate and an end date? You could use generate_series(), which is built-in since 8.0 and easily written in earlier versions. SELECT date'2006-02-01'

Re: [SQL] Given 02-01-2006 to 02-28-2006, output all days.

2006-02-17 Thread Owen Jacobson
Henry Ortega wrote: (question about set of all days between two dates) I don't know of a builtin way to do it off the top of my head, but it's a pretty simple function to write: create function days (start date, finish date) returns setof date as $$ declare curdate date; begin curdate := st

[SQL] Given 02-01-2006 to 02-28-2006, output all days.

2006-02-17 Thread Henry Ortega
Is there a real quick way to do a query that will show me all the dates given a startdate and an end date?Given: 02-01-2006 and 02-28-2006it should give me:02-01-200602-02-2006..02-27-2006 02-28-2006Can this be done by a built-in function perhaps?